public LightToken(LightInputStream inputStream, int type, int channel, int index, int start, int stop, int line, int charPositionInLine) { Debug.Assert(type is >= sbyte.MinValue and <= sbyte.MaxValue); Debug.Assert(channel is >= sbyte.MinValue and <= sbyte.MaxValue); this.inputStream = inputStream; this.type = (sbyte)type; this.channel = (sbyte)channel; StartIndex = start; StopIndex = stop; TokenIndex = index; Line = line; Column = charPositionInLine; }
private void Parse(DiagnosticsReport diagnostics, IAssemblySource.ConsumeLineDelegate consumeLine) { var inputStream = new LightInputStream(Input.ReadToEnd()); var lexer = new ScAsmLexer(inputStream) { TokenFactory = new LightTokenFactory() }; lexer.RemoveErrorListeners(); lexer.AddErrorListener(new SyntaxErrorListener <int>(diagnostics)); var tokens = new CommonTokenStream(lexer); var parser = new ScAsmParser(tokens) { BuildParseTree = false }; parser.AddParseListener(new ParseListener(this, parser, consumeLine)); parser.RemoveErrorListeners(); parser.AddErrorListener(new SyntaxErrorListener <IToken>(diagnostics)); parser.program(); }