2
Parser.frame file for NRefactory.
5
using System.Reflection;
11
internal class Parser : AbstractParser
24
public Parser(ILexer lexer) : base(lexer)
28
public override void Parse()
33
protected void ExpectWeak(int n, int follow)
35
if (lexer.LookAhead.kind == n) {
39
while (!StartOf(follow)) {
45
protected bool WeakSeparator(int n, int syFol, int repFol)
47
bool[] s = new bool[maxT + 1];
49
if (lexer.LookAhead.kind == n) {
52
} else if (StartOf(repFol)) {
55
for (int i = 0; i <= maxT; i++) {
56
s[i] = set[syFol, i] || set[repFol, i] || set[0, i];
59
while (!s[lexer.LookAhead.kind]) {
62
return StartOf(syFol);
66
protected override void SynErr(int line, int col, int errorNumber)
70
switch (errorNumber) {
72
default: s = "error " + errorNumber; break;
74
errors.Error(line, col, s);
77
protected bool StartOf(int s)
79
return set[s, lexer.LookAhead.kind];
82
static bool[,] set = {