Sha256: 0c926a0cc2235e8cf46582e848add92bdb698418cc309f79ab8ddb27a409fef3
Contents?: true
Size: 933 Bytes
Versions: 1
Compression:
Stored size: 933 Bytes
Contents
#pragma once #include <list> #include <stack> #include "antlr4-runtime.h" class Python3LexerBase : public antlr4::Lexer { public: Python3LexerBase(antlr4::CharStream *input); ~Python3LexerBase(); virtual void emitp(antlr4::Token* newToken); virtual void emit(std::unique_ptr<antlr4::Token> newToken) override; virtual std::unique_ptr<antlr4::Token> nextToken() override; bool atStartOfInput(); static int getIndentationCount(std::string spaces); protected: antlr4::CommonToken* commonToken(size_t type, std::string text); antlr4::CommonToken* createDedent(); // A queue where extra tokens are pushed on (see the NEWLINE lexer rule). std::list<antlr4::Token*>* tokens; // The stack that keeps track of the indentation level. std::stack<int>* indents; // The amount of opened braces, brackets and parenthesis. int opened = 0; // The most recently produced token. antlr4::Token* lastToken; };
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
python3-parser-1.0.0 | ext/python3-parser/Python3LexerBase.h |