Ejemplo n.º 1
0
        internal Lexer(SourceUnit unit, HappyLanguageContext languageContext)
        {
            _reader = new InputReader(unit);
            _errorCollector = new ErrorCollector(languageContext.ErrorSink);
            PushState(LexerMode.LexingStatement);

            _keywords["if"] = HappyTokenKind.KeywordIf;
            _keywords["else"] = HappyTokenKind.KeywordElse;
            _keywords["while"] = HappyTokenKind.KeywordWhile;
            _keywords["for"] = HappyTokenKind.KeywordFor;
            _keywords["in"] = HappyTokenKind.KeywordIn;
            _keywords["between"] = HappyTokenKind.KeywordBetween;
            _keywords["where"] = HappyTokenKind.KeywordWhere;
            _keywords["lookup"] = HappyTokenKind.KeywordLookup;
            _keywords["default"] = HappyTokenKind.KeywordDefault;
            _keywords["true"] = HappyTokenKind.LiteralBool;
            _keywords["false"] = HappyTokenKind.LiteralBool;
            _keywords["return"] = HappyTokenKind.KeywordReturn;
            _keywords["def"] = HappyTokenKind.KeywordDef;
            _keywords["null"] = HappyTokenKind.LiteralNull;
            _keywords["load"] = HappyTokenKind.KeywordLoad;
            _keywords["use"] = HappyTokenKind.KeywordUse;
            _keywords["new"] = HappyTokenKind.KeywordNew;
            _keywords["function"] = HappyTokenKind.KeywordFunction;
            _keywords["break"] = HappyTokenKind.KeywordBreak;
            _keywords["continue"] = HappyTokenKind.KeywordContinue;
            _keywords["switch"] = HappyTokenKind.KeywordSwitch;
            _keywords["case"] = HappyTokenKind.KeywordCase;
        }
Ejemplo n.º 2
0
 internal Parser(Lexer lexer, HappyLanguageContext languageContext)
 {
     _lexer = lexer;
     _errorCollector = new ErrorCollector(languageContext.ErrorSink);
 }