📄 lex.cc
字号:
#include "parser.ih"Parser::Token Parser::lex(){ Token tok; unsigned state; tok.type = Token::ws; tok.value = ""; while (tok.type == Token::ws) { tok.value.clear(); // If there is a token on the stack, return that one first. if (!lex_stack.empty()) { tok = lex_stack.top(); lex_stack.pop(); } else if (lex_iter == lex_source.end()) { // If we are at the end of the string, return end_of_line token. tok.type = Token::end_of_line; } else { lex_state = 1; while (true) { state = lex_state; if (lex_iter != lex_source.end()) lex_state = lexerNextState(lex_state,*lex_iter); else lex_state = 0; if (!lex_state) { tok.type = isEndState(state); if (tok.type) break; else { // throw lexer_error(); tok.type = Token::error; break; } } tok.value += *(lex_iter)++; } } } // cerr << "Token(" << tok.type << ",'" << tok.value << "')." << endl; return tok;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -