MCPcopy Create free account
hub / github.com/KDE/kdevelop / nextTokenKind

Method nextTokenKind

plugins/qmakemanager/parser/qmakelexer.cpp:75–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75int Lexer::nextTokenKind()
76{
77 int token = Parser::Token_INVALID;
78 if (m_curpos >= m_contentSize) {
79 return 0;
80 }
81 QChar* it = m_content.data();
82 it += m_curpos;
83 switch (state()) {
84 case VariableValueState:
85 it = ignoreWhitespaceAndComment(it);
86 m_tokenBegin = m_curpos;
87 if (m_curpos < m_contentSize) {
88 if (it->unicode() == '}') {
89 popState();
90 token = Parser::Token_RBRACE;
91 } else if (it->unicode() == '\n') {
92 popState();
93 createNewline(m_curpos);
94 token = Parser::Token_NEWLINE;
95 } else if (it->unicode() == '\\' && isCont(it)) {
96 pushState(ContState);
97 token = Parser::Token_CONT;
98 } else if (it->unicode() == '"') {
99 it++;
100 m_curpos++;
101 QChar* lastit = it;
102 while ((it->unicode() != '"' || (lastit->unicode() == '\\' && it->unicode() == '"'))
103 && it->unicode() != '\n' && it->unicode() != '#' && !isCont(it) && m_curpos < m_contentSize) {
104 lastit = it;
105 it++;
106 m_curpos++;
107 }
108 if (it->unicode() != '"' && it->unicode() != '#') {
109 m_curpos--;
110 }
111 token = Parser::Token_VALUE;
112 if (it->unicode() == '#') {
113 m_tokenEnd = m_curpos - 1;
114 do {
115 it++;
116 m_curpos++;
117 } while (it->unicode() != '\n' && m_curpos < m_contentSize);
118 if (it->unicode() == '\n') {
119 m_curpos--;
120 }
121 return token;
122 }
123 } else if (it->unicode() == '(') {
124 unsigned int bracecount = 0;
125 while ((it->unicode() != ';' || bracecount > 0) && it->unicode() != '\n' && !isCont(it)
126 && m_curpos < m_contentSize) {
127 if (it->unicode() == '(') {
128 bracecount++;
129 } else if (it->unicode() == ')' && bracecount > 0) {
130 bracecount--;
131 }
132 ++it;

Callers 5

runSessionMethod · 0.80
varAssignmentMethod · 0.80
functionsMethod · 0.80
operatorsMethod · 0.80
scopeMethod · 0.80

Calls 5

isContFunction · 0.85
isIdentifierCharacterFunction · 0.85
isEndIdentifierCharacterFunction · 0.85
dataMethod · 0.45

Tested by 4

varAssignmentMethod · 0.64
functionsMethod · 0.64
operatorsMethod · 0.64
scopeMethod · 0.64