public Parser( MarkedString source, Dictionary <string, Variable> vars, Dictionary <string, MethodOperation.Factory> funcs ) : base(new VarAssignLexer(source, vars, funcs), vars, funcs) { }
public static IBaseExpression Parse( MarkedString expr, Dictionary <string, Variable> vars, Dictionary <string, MethodOperation.Factory> funcs ) { return(new Parser(expr, vars, funcs).Parse()); }
public void RevertToCopy(MarkedString other) { pos = other.pos; cachedPos = other.cachedPos; Line = other.Line; CachedLine = other.CachedLine; CharInLine = other.CharInLine; CachedCharInLine = other.CachedCharInLine; }
public int Match(MarkedString source) { var res = source.MatchOne(regex); if (!res.Success) { LastError = "no match for '" + regex.ToString() + "' regex"; } else { LastError = ""; } lastMatch = res.Value; return(res.Success ? res.Length : -1); }
public int Match(MarkedString source) { MarkedString saved = source.ShallowCopy(); int last = source.AbsoluteAt; lastMatch = factory(source); if (lastMatch == null) { source.RevertToCopy(saved); LastError = "cannot parse " + name; return(-1); } int res = source.AbsoluteAt - last; source.RevertToCopy(saved); return(res); }
public static VarDefStatement Parse( MarkedString source, Dictionary <string, Variable> vars ) => new Parser(source, vars).Parse();
public static VarAssignStatement Parse( MarkedString source, Dictionary <string, Variable> vars, Dictionary <string, MethodOperation.Factory> funcs ) => new Parser(source, vars, funcs).Parse();
public Parser(MarkedString source, Dictionary <string, Variable> vars) : base(new VarDefLexer(source), vars) { }