| using Nemerle.Builtins;
using Nemerle.Collections;
using Nemerle.Core;
using Nemerle.Internal;
using Nemerle.Parser;
using Nemerle.Parser.Internal;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;
internal abstract class CalcParser
{
public sealed class GrammarImpl : CalcParser, IGrammar
{
public sealed class GrammarDescriptorImpl : GrammarDescriptor
{
public class _#postfix#_add_ : RuleDescriptor
{
private static readonly CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_add_ _staticDescriptor;
public override string Name
{
get
{
return "add";
}
}
public override GrammarDescriptor Grammar
{
get
{
return CalcParser.GrammarImpl.StaticDescriptor;
}
}
public static RuleDescriptor StaticDescriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_add_._staticDescriptor;
}
}
static _#postfix#_add_()
{
CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_add_._staticDescriptor = new CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_add_();
}
public CalcParser.Expr.Add ResultType()
{
return null;
}
private _#postfix#_add_()
{
}
}
public class _#simple#__any_ : RuleDescriptor
{
private static readonly CalcParser.GrammarImpl.GrammarDescriptorImpl._#simple#__any_ _staticDescriptor;
public override string Name
{
get
{
return "any";
}
}
public override GrammarDescriptor Grammar
{
get
{
return CalcParser.GrammarImpl.StaticDescriptor;
}
}
public static RuleDescriptor StaticDescriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#simple#__any_._staticDescriptor;
}
}
static _#simple#__any_()
{
CalcParser.GrammarImpl.GrammarDescriptorImpl._#simple#__any_._staticDescriptor = new CalcParser.GrammarImpl.GrammarDescriptorImpl._#simple#__any_();
}
private _#simple#__any_()
{
}
}
public class _#postfix#_div_ : RuleDescriptor
{
private static readonly CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_div_ _staticDescriptor;
public override string Name
{
get
{
return "div";
}
}
public override GrammarDescriptor Grammar
{
get
{
return CalcParser.GrammarImpl.StaticDescriptor;
}
}
public static RuleDescriptor StaticDescriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_div_._staticDescriptor;
}
}
static _#postfix#_div_()
{
CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_div_._staticDescriptor = new CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_div_();
}
public CalcParser.Expr.Div ResultType()
{
return null;
}
private _#postfix#_div_()
{
}
}
public class _#point#___expr_ : RuleDescriptor
{
private static readonly CalcParser.GrammarImpl.GrammarDescriptorImpl._#point#___expr_ _staticDescriptor;
public override string Name
{
get
{
return "expr";
}
}
public override GrammarDescriptor Grammar
{
get
{
return CalcParser.GrammarImpl.StaticDescriptor;
}
}
public static RuleDescriptor StaticDescriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#point#___expr_._staticDescriptor;
}
}
static _#point#___expr_()
{
CalcParser.GrammarImpl.GrammarDescriptorImpl._#point#___expr_._staticDescriptor = new CalcParser.GrammarImpl.GrammarDescriptorImpl._#point#___expr_();
}
public ExprAst ResultType()
{
return null;
}
private _#point#___expr_()
{
}
}
public class _#postfix#_mod_ : RuleDescriptor
{
private static readonly CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_mod_ _staticDescriptor;
public override string Name
{
get
{
return "mod";
}
}
public override GrammarDescriptor Grammar
{
get
{
return CalcParser.GrammarImpl.StaticDescriptor;
}
}
public static RuleDescriptor StaticDescriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_mod_._staticDescriptor;
}
}
static _#postfix#_mod_()
{
CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_mod_._staticDescriptor = new CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_mod_();
}
public CalcParser.Expr.Mod ResultType()
{
return null;
}
private _#postfix#_mod_()
{
}
}
public class _#postfix#_mul_ : RuleDescriptor
{
private static readonly CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_mul_ _staticDescriptor;
public override string Name
{
get
{
return "mul";
}
}
public override GrammarDescriptor Grammar
{
get
{
return CalcParser.GrammarImpl.StaticDescriptor;
}
}
public static RuleDescriptor StaticDescriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_mul_._staticDescriptor;
}
}
static _#postfix#_mul_()
{
CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_mul_._staticDescriptor = new CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_mul_();
}
public CalcParser.Expr.Mul ResultType()
{
return null;
}
private _#postfix#_mul_()
{
}
}
public class _#prefix#__neg_ : RuleDescriptor
{
private static readonly CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__neg_ _staticDescriptor;
public override string Name
{
get
{
return "neg";
}
}
public override GrammarDescriptor Grammar
{
get
{
return CalcParser.GrammarImpl.StaticDescriptor;
}
}
public static RuleDescriptor StaticDescriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__neg_._staticDescriptor;
}
}
static _#prefix#__neg_()
{
CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__neg_._staticDescriptor = new CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__neg_();
}
public CalcParser.Expr.Neg ResultType()
{
return null;
}
private _#prefix#__neg_()
{
}
}
public class _#prefix#__num_ : RuleDescriptor
{
private static readonly CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__num_ _staticDescriptor;
public override string Name
{
get
{
return "num";
}
}
public override GrammarDescriptor Grammar
{
get
{
return CalcParser.GrammarImpl.StaticDescriptor;
}
}
public static RuleDescriptor StaticDescriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__num_._staticDescriptor;
}
}
static _#prefix#__num_()
{
CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__num_._staticDescriptor = new CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__num_();
}
public CalcParser.Expr.Num ResultType()
{
return null;
}
private _#prefix#__num_()
{
}
}
public class _#postfix#_postfixDec_ : RuleDescriptor
{
private static readonly CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_postfixDec_ _staticDescriptor;
public override string Name
{
get
{
return "postfixDec";
}
}
public override GrammarDescriptor Grammar
{
get
{
return CalcParser.GrammarImpl.StaticDescriptor;
}
}
public static RuleDescriptor StaticDescriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_postfixDec_._staticDescriptor;
}
}
static _#postfix#_postfixDec_()
{
CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_postfixDec_._staticDescriptor = new CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_postfixDec_();
}
public CalcParser.Expr.PostfixDec ResultType()
{
return null;
}
private _#postfix#_postfixDec_()
{
}
}
public class _#postfix#_pow_ : RuleDescriptor
{
private static readonly CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_pow_ _staticDescriptor;
public override string Name
{
get
{
return "pow";
}
}
public override GrammarDescriptor Grammar
{
get
{
return CalcParser.GrammarImpl.StaticDescriptor;
}
}
public static RuleDescriptor StaticDescriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_pow_._staticDescriptor;
}
}
static _#postfix#_pow_()
{
CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_pow_._staticDescriptor = new CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_pow_();
}
public CalcParser.Expr.Pow ResultType()
{
return null;
}
private _#postfix#_pow_()
{
}
}
public class _#prefix#__prefixDec_ : RuleDescriptor
{
private static readonly CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__prefixDec_ _staticDescriptor;
public override string Name
{
get
{
return "prefixDec";
}
}
public override GrammarDescriptor Grammar
{
get
{
return CalcParser.GrammarImpl.StaticDescriptor;
}
}
public static RuleDescriptor StaticDescriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__prefixDec_._staticDescriptor;
}
}
static _#prefix#__prefixDec_()
{
CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__prefixDec_._staticDescriptor = new CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__prefixDec_();
}
public CalcParser.Expr.PrefixDec ResultType()
{
return null;
}
private _#prefix#__prefixDec_()
{
}
}
public class _#prefix#__rounds_ : RuleDescriptor
{
private static readonly CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__rounds_ _staticDescriptor;
public override string Name
{
get
{
return "rounds";
}
}
public override GrammarDescriptor Grammar
{
get
{
return CalcParser.GrammarImpl.StaticDescriptor;
}
}
public static RuleDescriptor StaticDescriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__rounds_._staticDescriptor;
}
}
static _#prefix#__rounds_()
{
CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__rounds_._staticDescriptor = new CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__rounds_();
}
public CalcParser.Expr.Rounds ResultType()
{
return null;
}
private _#prefix#__rounds_()
{
}
}
public class _#simple#__s_ : RuleDescriptor
{
private static readonly CalcParser.GrammarImpl.GrammarDescriptorImpl._#simple#__s_ _staticDescriptor;
public override string Name
{
get
{
return "s";
}
}
public override GrammarDescriptor Grammar
{
get
{
return CalcParser.GrammarImpl.StaticDescriptor;
}
}
public static RuleDescriptor StaticDescriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#simple#__s_._staticDescriptor;
}
}
static _#simple#__s_()
{
CalcParser.GrammarImpl.GrammarDescriptorImpl._#simple#__s_._staticDescriptor = new CalcParser.GrammarImpl.GrammarDescriptorImpl._#simple#__s_();
}
public void ResultType()
{
}
private _#simple#__s_()
{
}
}
public class _#prefix#__seq_ : RuleDescriptor
{
private static readonly CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__seq_ _staticDescriptor;
public override string Name
{
get
{
return "seq";
}
}
public override GrammarDescriptor Grammar
{
get
{
return CalcParser.GrammarImpl.StaticDescriptor;
}
}
public static RuleDescriptor StaticDescriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__seq_._staticDescriptor;
}
}
static _#prefix#__seq_()
{
CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__seq_._staticDescriptor = new CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__seq_();
}
public CalcParser.Expr.Seq ResultType()
{
return null;
}
private _#prefix#__seq_()
{
}
}
public class _#simple#__start_ : RuleDescriptor
{
private static readonly CalcParser.GrammarImpl.GrammarDescriptorImpl._#simple#__start_ _staticDescriptor;
public override string Name
{
get
{
return "start";
}
}
public override GrammarDescriptor Grammar
{
get
{
return CalcParser.GrammarImpl.StaticDescriptor;
}
}
public static RuleDescriptor StaticDescriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#simple#__start_._staticDescriptor;
}
}
static _#simple#__start_()
{
CalcParser.GrammarImpl.GrammarDescriptorImpl._#simple#__start_._staticDescriptor = new CalcParser.GrammarImpl.GrammarDescriptorImpl._#simple#__start_();
}
public ExprAst ResultType()
{
return null;
}
private _#simple#__start_()
{
}
}
public class _#postfix#_sub_ : RuleDescriptor
{
private static readonly CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_sub_ _staticDescriptor;
public override string Name
{
get
{
return "sub";
}
}
public override GrammarDescriptor Grammar
{
get
{
return CalcParser.GrammarImpl.StaticDescriptor;
}
}
public static RuleDescriptor StaticDescriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_sub_._staticDescriptor;
}
}
static _#postfix#_sub_()
{
CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_sub_._staticDescriptor = new CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_sub_();
}
public CalcParser.Expr.Sub ResultType()
{
return null;
}
private _#postfix#_sub_()
{
}
}
public override GrammarDescriptor[] Dependencies
{
get
{
return new GrammarDescriptor[]
{
NumParser.GrammarImpl.StaticDescriptor,
IncParser.GrammarImpl.StaticDescriptor
};
}
}
public override string Name
{
get
{
return "CalcParser";
}
}
public override string FullName
{
get
{
return "CalcParser";
}
}
public override IGrammar NewGrammar(Parser parser)
{
return new CalcParser.GrammarImpl(parser);
}
public override ParsingErrors NewParsingErrors()
{
return new CalcParser.GrammarImpl.ParsingErrorsImpl();
}
}
private sealed class ParsingErrorsImpl : ParsingErrors
{
public int _#_sub_;
public int _#_start_;
public int _#_seq_;
public int _#_s_;
public int _#_rounds_;
public int _#_prefixDec_;
public int _#_pow_;
public int _#_postfixDec_;
public int _#_num_;
public int _#_neg_;
public int _#_mul_;
public int _#_mod_;
public int _#_expr_;
public int _#_div_;
public int _#_any_;
public int _#_add_;
public override void Clear()
{
this._#_add_ = -1;
this._#_any_ = -1;
this._#_div_ = -1;
this._#_expr_ = -1;
this._#_mod_ = -1;
this._#_mul_ = -1;
this._#_neg_ = -1;
this._#_num_ = -1;
this._#_postfixDec_ = -1;
this._#_pow_ = -1;
this._#_prefixDec_ = -1;
this._#_rounds_ = -1;
this._#_s_ = -1;
this._#_seq_ = -1;
this._#_start_ = -1;
this._#_sub_ = -1;
}
public override void GetErrors(ref int pos, List<RuleDescriptor> descriptors)
{
int arg_04_0 = pos;
if (pos < this._#_add_)
{
pos = this._#_add_;
descriptors.Clear();
}
if (pos == this._#_add_)
{
descriptors.Add(CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_add_.StaticDescriptor);
}
if (pos < this._#_any_)
{
pos = this._#_any_;
descriptors.Clear();
}
if (pos == this._#_any_)
{
descriptors.Add(CalcParser.GrammarImpl.GrammarDescriptorImpl._#simple#__any_.StaticDescriptor);
}
if (pos < this._#_div_)
{
pos = this._#_div_;
descriptors.Clear();
}
if (pos == this._#_div_)
{
descriptors.Add(CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_div_.StaticDescriptor);
}
if (pos < this._#_expr_)
{
pos = this._#_expr_;
descriptors.Clear();
}
if (pos == this._#_expr_)
{
descriptors.Add(CalcParser.GrammarImpl.GrammarDescriptorImpl._#point#___expr_.StaticDescriptor);
}
if (pos < this._#_mod_)
{
pos = this._#_mod_;
descriptors.Clear();
}
if (pos == this._#_mod_)
{
descriptors.Add(CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_mod_.StaticDescriptor);
}
if (pos < this._#_mul_)
{
pos = this._#_mul_;
descriptors.Clear();
}
if (pos == this._#_mul_)
{
descriptors.Add(CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_mul_.StaticDescriptor);
}
if (pos < this._#_neg_)
{
pos = this._#_neg_;
descriptors.Clear();
}
if (pos == this._#_neg_)
{
descriptors.Add(CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__neg_.StaticDescriptor);
}
if (pos < this._#_num_)
{
pos = this._#_num_;
descriptors.Clear();
}
if (pos == this._#_num_)
{
descriptors.Add(CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__num_.StaticDescriptor);
}
if (pos < this._#_postfixDec_)
{
pos = this._#_postfixDec_;
descriptors.Clear();
}
if (pos == this._#_postfixDec_)
{
descriptors.Add(CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_postfixDec_.StaticDescriptor);
}
if (pos < this._#_pow_)
{
pos = this._#_pow_;
descriptors.Clear();
}
if (pos == this._#_pow_)
{
descriptors.Add(CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_pow_.StaticDescriptor);
}
if (pos < this._#_prefixDec_)
{
pos = this._#_prefixDec_;
descriptors.Clear();
}
if (pos == this._#_prefixDec_)
{
descriptors.Add(CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__prefixDec_.StaticDescriptor);
}
if (pos < this._#_rounds_)
{
pos = this._#_rounds_;
descriptors.Clear();
}
if (pos == this._#_rounds_)
{
descriptors.Add(CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__rounds_.StaticDescriptor);
}
if (pos < this._#_s_)
{
pos = this._#_s_;
descriptors.Clear();
}
if (pos == this._#_s_)
{
descriptors.Add(CalcParser.GrammarImpl.GrammarDescriptorImpl._#simple#__s_.StaticDescriptor);
}
if (pos < this._#_seq_)
{
pos = this._#_seq_;
descriptors.Clear();
}
if (pos == this._#_seq_)
{
descriptors.Add(CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__seq_.StaticDescriptor);
}
if (pos < this._#_start_)
{
pos = this._#_start_;
descriptors.Clear();
}
if (pos == this._#_start_)
{
descriptors.Add(CalcParser.GrammarImpl.GrammarDescriptorImpl._#simple#__start_.StaticDescriptor);
}
if (pos < this._#_sub_)
{
pos = this._#_sub_;
descriptors.Clear();
}
if (pos == this._#_sub_)
{
descriptors.Add(CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_sub_.StaticDescriptor);
}
}
public ParsingErrorsImpl()
{
this.Clear();
}
}
private sealed class GrammarStateImpl : IGrammarState
{
private readonly ExtensionPostfixBase<ExprAst>[] _#_expr_PostfixRules_;
private readonly ExtensionPrefixBase<ExprAst>[] _#_expr_PrefixRules__;
[DebuggerBrowsable(DebuggerBrowsableState.Never), CompilerGenerated]
private readonly CalcParser.GrammarImpl _N_Grammar_4132;
public CalcParser.GrammarImpl Grammar
{
[CompilerGenerated]
get
{
return this._N_Grammar_4132;
}
}
public void LoadThisState()
{
this.Grammar._#_expr_PrefixRules__ = this._#_expr_PrefixRules__;
this.Grammar._#_expr_PostfixRules_ = this._#_expr_PostfixRules_;
}
public GrammarStateImpl(CalcParser.GrammarImpl grammar)
{
this._N_Grammar_4132 = grammar;
this._#_expr_PrefixRules__ = this._N_Grammar_4132._#_expr_PrefixRules__;
this._#_expr_PostfixRules_ = this._N_Grammar_4132._#_expr_PostfixRules_;
}
public GrammarStateImpl()
{
}
IGrammar IGrammarState.get_Grammar()
{
return this.Grammar;
}
}
public class _#postfix#_sub_ : ExtensionPostfixBase<ExprAst>
{
private readonly CalcParser.GrammarImpl _grammar;
public override RuleDescriptor Descriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_sub_.StaticDescriptor;
}
}
public override int Parse(int startPos, int pos, string text, int[] bestOffsets, ref ExprAst result)
{
bool isBest = false;
NToken token_2 = default(NToken);
ExprAst token_3 = null;
ExprAst prefixResult = result;
ExprAst token_4 = prefixResult;
bool _N_cache_8663 = pos >= 0;
bool arg_AA_0;
if (_N_cache_8663)
{
if (true)
{
if (isBest)
{
arg_AA_0 = true;
}
else
{
isBest = (bestOffsets[0] < pos);
arg_AA_0 = (isBest || bestOffsets[0] == pos);
}
goto IL_9F;
}
}
arg_AA_0 = false;
IL_9F:
int arg_36F_0;
if (arg_AA_0)
{
int arg_108_0;
if (pos < text.Length)
{
char c = text[pos];
arg_108_0 = ((c != '-') ? -1 : (pos + 1));
}
else
{
arg_108_0 = -1;
}
int newPos = arg_108_0;
if (newPos >= 0)
{
token_2 = new NToken(pos, newPos);
}
int pos2 = newPos;
bool _N_cache_8664 = pos2 >= 0;
bool arg_197_0;
if (_N_cache_8664)
{
if (true)
{
if (isBest)
{
arg_197_0 = true;
}
else
{
isBest = (bestOffsets[1] < pos2);
arg_197_0 = (isBest || bestOffsets[1] == pos2);
}
goto IL_18C;
}
}
arg_197_0 = false;
IL_18C:
if (arg_197_0)
{
int ofs = pos2;
int pos3 = this._grammar._#_s_(pos2, text);
bool _N_cache_8665 = pos3 >= 0;
bool arg_224_0;
if (_N_cache_8665)
{
if (true)
{
if (isBest)
{
arg_224_0 = true;
}
else
{
isBest = (bestOffsets[2] < pos3);
arg_224_0 = (isBest || bestOffsets[2] == pos3);
}
goto IL_219;
}
}
arg_224_0 = false;
IL_219:
if (arg_224_0)
{
int ofs2 = pos3;
int pos4 = this._grammar._#_expr_(pos3, text, 10, ref token_3);
bool _N_cache_8666 = pos4 >= 0;
bool arg_2B5_0;
if (_N_cache_8666)
{
if (true)
{
if (isBest)
{
arg_2B5_0 = true;
}
else
{
isBest = (bestOffsets[3] < pos4);
arg_2B5_0 = (isBest || bestOffsets[3] == pos4);
}
goto IL_2AA;
}
}
arg_2B5_0 = false;
IL_2AA:
if (arg_2B5_0)
{
int ofs3 = pos4;
if (isBest)
{
bestOffsets[0] = pos;
bestOffsets[1] = ofs;
bestOffsets[2] = ofs2;
bestOffsets[3] = ofs3;
int i = 4;
while (i < bestOffsets.Length && bestOffsets[i] >= 0)
{
bestOffsets[i] = -1;
i++;
}
arg_36F_0 = pos4;
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
int newPos2 = arg_36F_0;
if (newPos2 > 0)
{
result = new CalcParser.Expr.Sub(token_4, token_2, token_3);
result.Location = new Location(this._grammar._parsingSource, token_4.StartPos, token_3.EndPos);
}
else
{
if (this._grammar._parsingErrors._#_sub_ < pos)
{
this._grammar._parsingErrors._#_sub_ = pos;
}
}
return newPos2;
}
public _#postfix#_sub_(IGrammar grammar) : base(10, '\0', '?')
{
this._grammar = (CalcParser.GrammarImpl)grammar;
}
}
public class _#prefix#__seq_ : ExtensionPrefixBase<ExprAst>
{
private readonly CalcParser.GrammarImpl _grammar;
public override RuleDescriptor Descriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__seq_.StaticDescriptor;
}
}
public override int Parse(int pos, string text, int[] bestOffsets, ref ExprAst result)
{
bool isBest = false;
NToken token_ = default(NToken);
list<ExprAst> token_2 = null;
NToken token_3 = default(NToken);
int arg_88_0;
if (pos < text.Length)
{
char c = text[pos];
arg_88_0 = ((c != '{') ? -1 : (pos + 1));
}
else
{
arg_88_0 = -1;
}
int newPos = arg_88_0;
if (newPos >= 0)
{
token_ = new NToken(pos, newPos);
}
int pos2 = newPos;
bool _N_cache_8962 = pos2 >= 0;
bool arg_113_0;
if (_N_cache_8962)
{
if (true)
{
if (isBest)
{
arg_113_0 = true;
}
else
{
isBest = (bestOffsets[0] < pos2);
arg_113_0 = (isBest || bestOffsets[0] == pos2);
}
goto IL_108;
}
}
arg_113_0 = false;
IL_108:
int arg_4C6_0;
if (arg_113_0)
{
int ofs0 = pos2;
int pos3 = this._grammar._#_s_(pos2, text);
bool _N_cache_8963 = pos3 >= 0;
bool arg_19E_0;
if (_N_cache_8963)
{
if (true)
{
if (isBest)
{
arg_19E_0 = true;
}
else
{
isBest = (bestOffsets[1] < pos3);
arg_19E_0 = (isBest || bestOffsets[1] == pos3);
}
goto IL_193;
}
}
arg_19E_0 = false;
IL_193:
if (arg_19E_0)
{
int ofs = pos3;
List<ExprAst> tmpList = new List<ExprAst>();
ExprAst token_4 = null;
int num = pos3;
while (true)
{
int newPos2 = this._grammar._#_expr_(num, text, 0, ref token_4);
if (newPos2 < 0)
{
break;
}
tmpList.Add(token_4);
num = newPos2;
}
int newPos3 = num;
token_2 = tmpList.NToList<ExprAst>();
int pos4 = newPos3;
bool _N_cache_8964 = pos4 >= 0;
bool arg_28A_0;
if (_N_cache_8964)
{
if (true)
{
if (isBest)
{
arg_28A_0 = true;
}
else
{
isBest = (bestOffsets[2] < pos4);
arg_28A_0 = (isBest || bestOffsets[2] == pos4);
}
goto IL_27F;
}
}
arg_28A_0 = false;
IL_27F:
if (arg_28A_0)
{
int ofs2 = pos4;
int arg_2E8_0;
if (pos4 < text.Length)
{
char c = text[pos4];
arg_2E8_0 = ((c != '}') ? -1 : (pos4 + 1));
}
else
{
arg_2E8_0 = -1;
}
int newPos4 = arg_2E8_0;
if (newPos4 >= 0)
{
token_3 = new NToken(pos4, newPos4);
}
int pos5 = newPos4;
bool _N_cache_8965 = pos5 >= 0;
bool arg_375_0;
if (_N_cache_8965)
{
if (true)
{
if (isBest)
{
arg_375_0 = true;
}
else
{
isBest = (bestOffsets[3] < pos5);
arg_375_0 = (isBest || bestOffsets[3] == pos5);
}
goto IL_36A;
}
}
arg_375_0 = false;
IL_36A:
if (arg_375_0)
{
int ofs3 = pos5;
int pos6 = this._grammar._#_s_(pos5, text);
bool _N_cache_8966 = pos6 >= 0;
bool arg_400_0;
if (_N_cache_8966)
{
if (true)
{
if (isBest)
{
arg_400_0 = true;
}
else
{
isBest = (bestOffsets[4] < pos6);
arg_400_0 = (isBest || bestOffsets[4] == pos6);
}
goto IL_3F5;
}
}
arg_400_0 = false;
IL_3F5:
if (arg_400_0)
{
int ofs4 = pos6;
if (isBest)
{
bestOffsets[0] = ofs0;
bestOffsets[1] = ofs;
bestOffsets[2] = ofs2;
bestOffsets[3] = ofs3;
bestOffsets[4] = ofs4;
int i = 5;
while (i < bestOffsets.Length && bestOffsets[i] >= 0)
{
bestOffsets[i] = -1;
i++;
}
arg_4C6_0 = pos6;
}
else
{
arg_4C6_0 = -1;
}
}
else
{
arg_4C6_0 = -1;
}
}
else
{
arg_4C6_0 = -1;
}
}
else
{
arg_4C6_0 = -1;
}
}
else
{
arg_4C6_0 = -1;
}
}
else
{
arg_4C6_0 = -1;
}
int newPos5 = arg_4C6_0;
if (newPos5 > 0)
{
result = new CalcParser.Expr.Seq(token_, token_2, token_3);
result.Location = new Location(this._grammar._parsingSource, token_.StartPos, token_3.EndPos);
}
else
{
if (this._grammar._parsingErrors._#_seq_ < pos)
{
this._grammar._parsingErrors._#_seq_ = pos;
}
}
return newPos5;
}
public _#prefix#__seq_(IGrammar grammar) : base('\0', '?')
{
this._grammar = (CalcParser.GrammarImpl)grammar;
}
}
public class _#prefix#__rounds_ : ExtensionPrefixBase<ExprAst>
{
private readonly CalcParser.GrammarImpl _grammar;
public override RuleDescriptor Descriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__rounds_.StaticDescriptor;
}
}
public override int Parse(int pos, string text, int[] bestOffsets, ref ExprAst result)
{
bool isBest = false;
NToken token_ = default(NToken);
ExprAst token_2 = null;
NToken token_3 = default(NToken);
int arg_88_0;
if (pos < text.Length)
{
char c = text[pos];
arg_88_0 = ((c != '(') ? -1 : (pos + 1));
}
else
{
arg_88_0 = -1;
}
int newPos = arg_88_0;
if (newPos >= 0)
{
token_ = new NToken(pos, newPos);
}
int pos2 = newPos;
bool _N_cache_9115 = pos2 >= 0;
bool arg_113_0;
if (_N_cache_9115)
{
if (true)
{
if (isBest)
{
arg_113_0 = true;
}
else
{
isBest = (bestOffsets[0] < pos2);
arg_113_0 = (isBest || bestOffsets[0] == pos2);
}
goto IL_108;
}
}
arg_113_0 = false;
IL_108:
int arg_468_0;
if (arg_113_0)
{
int ofs0 = pos2;
int pos3 = this._grammar._#_s_(pos2, text);
bool _N_cache_9116 = pos3 >= 0;
bool arg_19E_0;
if (_N_cache_9116)
{
if (true)
{
if (isBest)
{
arg_19E_0 = true;
}
else
{
isBest = (bestOffsets[1] < pos3);
arg_19E_0 = (isBest || bestOffsets[1] == pos3);
}
goto IL_193;
}
}
arg_19E_0 = false;
IL_193:
if (arg_19E_0)
{
int ofs = pos3;
int pos4 = this._grammar._#_expr_(pos3, text, 0, ref token_2);
bool _N_cache_9117 = pos4 >= 0;
bool arg_22C_0;
if (_N_cache_9117)
{
if (true)
{
if (isBest)
{
arg_22C_0 = true;
}
else
{
isBest = (bestOffsets[2] < pos4);
arg_22C_0 = (isBest || bestOffsets[2] == pos4);
}
goto IL_221;
}
}
arg_22C_0 = false;
IL_221:
if (arg_22C_0)
{
int ofs2 = pos4;
int arg_28A_0;
if (pos4 < text.Length)
{
char c = text[pos4];
arg_28A_0 = ((c != ')') ? -1 : (pos4 + 1));
}
else
{
arg_28A_0 = -1;
}
int newPos2 = arg_28A_0;
if (newPos2 >= 0)
{
token_3 = new NToken(pos4, newPos2);
}
int pos5 = newPos2;
bool _N_cache_9118 = pos5 >= 0;
bool arg_317_0;
if (_N_cache_9118)
{
if (true)
{
if (isBest)
{
arg_317_0 = true;
}
else
{
isBest = (bestOffsets[3] < pos5);
arg_317_0 = (isBest || bestOffsets[3] == pos5);
}
goto IL_30C;
}
}
arg_317_0 = false;
IL_30C:
if (arg_317_0)
{
int ofs3 = pos5;
int pos6 = this._grammar._#_s_(pos5, text);
bool _N_cache_9119 = pos6 >= 0;
bool arg_3A2_0;
if (_N_cache_9119)
{
if (true)
{
if (isBest)
{
arg_3A2_0 = true;
}
else
{
isBest = (bestOffsets[4] < pos6);
arg_3A2_0 = (isBest || bestOffsets[4] == pos6);
}
goto IL_397;
}
}
arg_3A2_0 = false;
IL_397:
if (arg_3A2_0)
{
int ofs4 = pos6;
if (isBest)
{
bestOffsets[0] = ofs0;
bestOffsets[1] = ofs;
bestOffsets[2] = ofs2;
bestOffsets[3] = ofs3;
bestOffsets[4] = ofs4;
int i = 5;
while (i < bestOffsets.Length && bestOffsets[i] >= 0)
{
bestOffsets[i] = -1;
i++;
}
arg_468_0 = pos6;
}
else
{
arg_468_0 = -1;
}
}
else
{
arg_468_0 = -1;
}
}
else
{
arg_468_0 = -1;
}
}
else
{
arg_468_0 = -1;
}
}
else
{
arg_468_0 = -1;
}
}
else
{
arg_468_0 = -1;
}
int newPos3 = arg_468_0;
if (newPos3 > 0)
{
result = new CalcParser.Expr.Rounds(token_, token_2, token_3);
result.Location = new Location(this._grammar._parsingSource, token_.StartPos, token_3.EndPos);
}
else
{
if (this._grammar._parsingErrors._#_rounds_ < pos)
{
this._grammar._parsingErrors._#_rounds_ = pos;
}
}
return newPos3;
}
public _#prefix#__rounds_(IGrammar grammar) : base('\0', '?')
{
this._grammar = (CalcParser.GrammarImpl)grammar;
}
}
public class _#prefix#__prefixDec_ : ExtensionPrefixBase<ExprAst>
{
private readonly CalcParser.GrammarImpl _grammar;
public override RuleDescriptor Descriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__prefixDec_.StaticDescriptor;
}
}
public override int Parse(int pos, string text, int[] bestOffsets, ref ExprAst result)
{
bool isBest = false;
NToken token_ = default(NToken);
ExprAst token_2 = null;
int newPos = (pos + 1 >= text.Length || text[pos] != '-' || text[pos + 1] != '-') ? -1 : (pos + 2);
if (newPos >= 0)
{
token_ = new NToken(pos, newPos);
}
int pos2 = newPos;
bool _N_cache_9259 = pos2 >= 0;
bool arg_117_0;
if (_N_cache_9259)
{
if (true)
{
if (isBest)
{
arg_117_0 = true;
}
else
{
isBest = (bestOffsets[0] < pos2);
arg_117_0 = (isBest || bestOffsets[0] == pos2);
}
goto IL_10C;
}
}
arg_117_0 = false;
IL_10C:
int arg_2D6_0;
if (arg_117_0)
{
int ofs0 = pos2;
int pos3 = this._grammar._#_s_(pos2, text);
bool _N_cache_9260 = pos3 >= 0;
bool arg_1A2_0;
if (_N_cache_9260)
{
if (true)
{
if (isBest)
{
arg_1A2_0 = true;
}
else
{
isBest = (bestOffsets[1] < pos3);
arg_1A2_0 = (isBest || bestOffsets[1] == pos3);
}
goto IL_197;
}
}
arg_1A2_0 = false;
IL_197:
if (arg_1A2_0)
{
int ofs = pos3;
int pos4 = this._grammar._#_expr_(pos3, text, 200, ref token_2);
bool _N_cache_9261 = pos4 >= 0;
bool arg_234_0;
if (_N_cache_9261)
{
if (true)
{
if (isBest)
{
arg_234_0 = true;
}
else
{
isBest = (bestOffsets[2] < pos4);
arg_234_0 = (isBest || bestOffsets[2] == pos4);
}
goto IL_229;
}
}
arg_234_0 = false;
IL_229:
if (arg_234_0)
{
int ofs2 = pos4;
if (isBest)
{
bestOffsets[0] = ofs0;
bestOffsets[1] = ofs;
bestOffsets[2] = ofs2;
int i = 3;
while (i < bestOffsets.Length && bestOffsets[i] >= 0)
{
bestOffsets[i] = -1;
i++;
}
arg_2D6_0 = pos4;
}
else
{
arg_2D6_0 = -1;
}
}
else
{
arg_2D6_0 = -1;
}
}
else
{
arg_2D6_0 = -1;
}
}
else
{
arg_2D6_0 = -1;
}
int newPos2 = arg_2D6_0;
if (newPos2 > 0)
{
result = new CalcParser.Expr.PrefixDec(token_, token_2);
result.Location = new Location(this._grammar._parsingSource, token_.StartPos, token_2.EndPos);
}
else
{
if (this._grammar._parsingErrors._#_prefixDec_ < pos)
{
this._grammar._parsingErrors._#_prefixDec_ = pos;
}
}
return newPos2;
}
public _#prefix#__prefixDec_(IGrammar grammar) : base('\0', '?')
{
this._grammar = (CalcParser.GrammarImpl)grammar;
}
}
public class _#postfix#_pow_ : ExtensionPostfixBase<ExprAst>
{
private readonly CalcParser.GrammarImpl _grammar;
public override RuleDescriptor Descriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_pow_.StaticDescriptor;
}
}
public override int Parse(int startPos, int pos, string text, int[] bestOffsets, ref ExprAst result)
{
bool isBest = false;
NToken token_2 = default(NToken);
ExprAst token_3 = null;
ExprAst prefixResult = result;
ExprAst token_4 = prefixResult;
bool _N_cache_9359 = pos >= 0;
bool arg_AA_0;
if (_N_cache_9359)
{
if (true)
{
if (isBest)
{
arg_AA_0 = true;
}
else
{
isBest = (bestOffsets[0] < pos);
arg_AA_0 = (isBest || bestOffsets[0] == pos);
}
goto IL_9F;
}
}
arg_AA_0 = false;
IL_9F:
int arg_36F_0;
if (arg_AA_0)
{
int arg_108_0;
if (pos < text.Length)
{
char c = text[pos];
arg_108_0 = ((c != '^') ? -1 : (pos + 1));
}
else
{
arg_108_0 = -1;
}
int newPos = arg_108_0;
if (newPos >= 0)
{
token_2 = new NToken(pos, newPos);
}
int pos2 = newPos;
bool _N_cache_9360 = pos2 >= 0;
bool arg_197_0;
if (_N_cache_9360)
{
if (true)
{
if (isBest)
{
arg_197_0 = true;
}
else
{
isBest = (bestOffsets[1] < pos2);
arg_197_0 = (isBest || bestOffsets[1] == pos2);
}
goto IL_18C;
}
}
arg_197_0 = false;
IL_18C:
if (arg_197_0)
{
int ofs = pos2;
int pos3 = this._grammar._#_s_(pos2, text);
bool _N_cache_9361 = pos3 >= 0;
bool arg_224_0;
if (_N_cache_9361)
{
if (true)
{
if (isBest)
{
arg_224_0 = true;
}
else
{
isBest = (bestOffsets[2] < pos3);
arg_224_0 = (isBest || bestOffsets[2] == pos3);
}
goto IL_219;
}
}
arg_224_0 = false;
IL_219:
if (arg_224_0)
{
int ofs2 = pos3;
int pos4 = this._grammar._#_expr_(pos3, text, 30, ref token_3);
bool _N_cache_9362 = pos4 >= 0;
bool arg_2B5_0;
if (_N_cache_9362)
{
if (true)
{
if (isBest)
{
arg_2B5_0 = true;
}
else
{
isBest = (bestOffsets[3] < pos4);
arg_2B5_0 = (isBest || bestOffsets[3] == pos4);
}
goto IL_2AA;
}
}
arg_2B5_0 = false;
IL_2AA:
if (arg_2B5_0)
{
int ofs3 = pos4;
if (isBest)
{
bestOffsets[0] = pos;
bestOffsets[1] = ofs;
bestOffsets[2] = ofs2;
bestOffsets[3] = ofs3;
int i = 4;
while (i < bestOffsets.Length && bestOffsets[i] >= 0)
{
bestOffsets[i] = -1;
i++;
}
arg_36F_0 = pos4;
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
int newPos2 = arg_36F_0;
if (newPos2 > 0)
{
result = new CalcParser.Expr.Pow(token_4, token_2, token_3);
result.Location = new Location(this._grammar._parsingSource, token_4.StartPos, token_3.EndPos);
}
else
{
if (this._grammar._parsingErrors._#_pow_ < pos)
{
this._grammar._parsingErrors._#_pow_ = pos;
}
}
return newPos2;
}
public _#postfix#_pow_(IGrammar grammar) : base(31, '\0', '?')
{
this._grammar = (CalcParser.GrammarImpl)grammar;
}
}
public class _#postfix#_postfixDec_ : ExtensionPostfixBase<ExprAst>
{
private readonly CalcParser.GrammarImpl _grammar;
public override RuleDescriptor Descriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_postfixDec_.StaticDescriptor;
}
}
public override int Parse(int startPos, int pos, string text, int[] bestOffsets, ref ExprAst result)
{
bool isBest = false;
NToken token_2 = default(NToken);
ExprAst prefixResult = result;
ExprAst token_3 = prefixResult;
bool _N_cache_9478 = pos >= 0;
bool arg_A6_0;
if (_N_cache_9478)
{
if (true)
{
if (isBest)
{
arg_A6_0 = true;
}
else
{
isBest = (bestOffsets[0] < pos);
arg_A6_0 = (isBest || bestOffsets[0] == pos);
}
goto IL_9B;
}
}
arg_A6_0 = false;
IL_9B:
int arg_2D9_0;
if (arg_A6_0)
{
int newPos = (pos + 1 >= text.Length || text[pos] != '-' || text[pos + 1] != '-') ? -1 : (pos + 2);
if (newPos >= 0)
{
token_2 = new NToken(pos, newPos);
}
int pos2 = newPos;
bool _N_cache_9479 = pos2 >= 0;
bool arg_1A5_0;
if (_N_cache_9479)
{
if (true)
{
if (isBest)
{
arg_1A5_0 = true;
}
else
{
isBest = (bestOffsets[1] < pos2);
arg_1A5_0 = (isBest || bestOffsets[1] == pos2);
}
goto IL_19A;
}
}
arg_1A5_0 = false;
IL_19A:
if (arg_1A5_0)
{
int ofs = pos2;
int pos3 = this._grammar._#_s_(pos2, text);
bool _N_cache_9480 = pos3 >= 0;
bool arg_232_0;
if (_N_cache_9480)
{
if (true)
{
if (isBest)
{
arg_232_0 = true;
}
else
{
isBest = (bestOffsets[2] < pos3);
arg_232_0 = (isBest || bestOffsets[2] == pos3);
}
goto IL_227;
}
}
arg_232_0 = false;
IL_227:
if (arg_232_0)
{
int ofs2 = pos3;
if (isBest)
{
bestOffsets[0] = pos;
bestOffsets[1] = ofs;
bestOffsets[2] = ofs2;
int i = 3;
while (i < bestOffsets.Length && bestOffsets[i] >= 0)
{
bestOffsets[i] = -1;
i++;
}
arg_2D9_0 = pos3;
}
else
{
arg_2D9_0 = -1;
}
}
else
{
arg_2D9_0 = -1;
}
}
else
{
arg_2D9_0 = -1;
}
}
else
{
arg_2D9_0 = -1;
}
int newPos2 = arg_2D9_0;
if (newPos2 > 0)
{
result = new CalcParser.Expr.PostfixDec(token_3, token_2);
result.Location = new Location(this._grammar._parsingSource, token_3.StartPos, token_2.EndPos);
}
else
{
if (this._grammar._parsingErrors._#_postfixDec_ < pos)
{
this._grammar._parsingErrors._#_postfixDec_ = pos;
}
}
return newPos2;
}
public _#postfix#_postfixDec_(IGrammar grammar) : base(200, '\0', '?')
{
this._grammar = (CalcParser.GrammarImpl)grammar;
}
}
public class _#prefix#__num_ : ExtensionPrefixBase<ExprAst>
{
private readonly CalcParser.GrammarImpl _grammar;
public override RuleDescriptor Descriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__num_.StaticDescriptor;
}
}
public override int Parse(int pos, string text, int[] bestOffsets, ref ExprAst result)
{
bool isBest = false;
string token_ = null;
int pos2 = this._grammar._#grammar#1._#_number_(pos, text, ref token_);
bool _N_cache_9580 = pos2 >= 0;
bool arg_A1_0;
if (_N_cache_9580)
{
if (true)
{
if (isBest)
{
arg_A1_0 = true;
}
else
{
isBest = (bestOffsets[0] < pos2);
arg_A1_0 = (isBest || bestOffsets[0] == pos2);
}
goto IL_96;
}
}
arg_A1_0 = false;
IL_96:
int arg_1BA_0;
if (arg_A1_0)
{
int ofs0 = pos2;
int pos3 = this._grammar._#_s_(pos2, text);
bool _N_cache_9581 = pos3 >= 0;
bool arg_12A_0;
if (_N_cache_9581)
{
if (true)
{
if (isBest)
{
arg_12A_0 = true;
}
else
{
isBest = (bestOffsets[1] < pos3);
arg_12A_0 = (isBest || bestOffsets[1] == pos3);
}
goto IL_11F;
}
}
arg_12A_0 = false;
IL_11F:
if (arg_12A_0)
{
int ofs = pos3;
if (isBest)
{
bestOffsets[0] = ofs0;
bestOffsets[1] = ofs;
int i = 2;
while (i < bestOffsets.Length && bestOffsets[i] >= 0)
{
bestOffsets[i] = -1;
i++;
}
arg_1BA_0 = pos3;
}
else
{
arg_1BA_0 = -1;
}
}
else
{
arg_1BA_0 = -1;
}
}
else
{
arg_1BA_0 = -1;
}
int newPos = arg_1BA_0;
if (newPos > 0)
{
result = new CalcParser.Expr.Num(token_);
result.Location = new Location(this._grammar._parsingSource, pos, newPos);
}
else
{
if (this._grammar._parsingErrors._#_num_ < pos)
{
this._grammar._parsingErrors._#_num_ = pos;
}
}
return newPos;
}
public _#prefix#__num_(IGrammar grammar) : base('\0', '?')
{
this._grammar = (CalcParser.GrammarImpl)grammar;
}
}
public class _#prefix#__neg_ : ExtensionPrefixBase<ExprAst>
{
private readonly CalcParser.GrammarImpl _grammar;
public override RuleDescriptor Descriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#prefix#__neg_.StaticDescriptor;
}
}
public override int Parse(int pos, string text, int[] bestOffsets, ref ExprAst result)
{
bool isBest = false;
NToken token_ = default(NToken);
ExprAst token_2 = null;
int arg_7B_0;
if (pos < text.Length)
{
char c = text[pos];
arg_7B_0 = ((c != '-') ? -1 : (pos + 1));
}
else
{
arg_7B_0 = -1;
}
int newPos = arg_7B_0;
if (newPos >= 0)
{
token_ = new NToken(pos, newPos);
}
int pos2 = newPos;
bool _N_cache_9670 = pos2 >= 0;
bool arg_106_0;
if (_N_cache_9670)
{
if (true)
{
if (isBest)
{
arg_106_0 = true;
}
else
{
isBest = (bestOffsets[0] < pos2);
arg_106_0 = (isBest || bestOffsets[0] == pos2);
}
goto IL_FB;
}
}
arg_106_0 = false;
IL_FB:
int arg_2C2_0;
if (arg_106_0)
{
int ofs0 = pos2;
int pos3 = this._grammar._#_s_(pos2, text);
bool _N_cache_9671 = pos3 >= 0;
bool arg_191_0;
if (_N_cache_9671)
{
if (true)
{
if (isBest)
{
arg_191_0 = true;
}
else
{
isBest = (bestOffsets[1] < pos3);
arg_191_0 = (isBest || bestOffsets[1] == pos3);
}
goto IL_186;
}
}
arg_191_0 = false;
IL_186:
if (arg_191_0)
{
int ofs = pos3;
int pos4 = this._grammar._#_expr_(pos3, text, 100, ref token_2);
bool _N_cache_9672 = pos4 >= 0;
bool arg_220_0;
if (_N_cache_9672)
{
if (true)
{
if (isBest)
{
arg_220_0 = true;
}
else
{
isBest = (bestOffsets[2] < pos4);
arg_220_0 = (isBest || bestOffsets[2] == pos4);
}
goto IL_215;
}
}
arg_220_0 = false;
IL_215:
if (arg_220_0)
{
int ofs2 = pos4;
if (isBest)
{
bestOffsets[0] = ofs0;
bestOffsets[1] = ofs;
bestOffsets[2] = ofs2;
int i = 3;
while (i < bestOffsets.Length && bestOffsets[i] >= 0)
{
bestOffsets[i] = -1;
i++;
}
arg_2C2_0 = pos4;
}
else
{
arg_2C2_0 = -1;
}
}
else
{
arg_2C2_0 = -1;
}
}
else
{
arg_2C2_0 = -1;
}
}
else
{
arg_2C2_0 = -1;
}
int newPos2 = arg_2C2_0;
if (newPos2 > 0)
{
result = new CalcParser.Expr.Neg(token_, token_2);
result.Location = new Location(this._grammar._parsingSource, token_.StartPos, token_2.EndPos);
}
else
{
if (this._grammar._parsingErrors._#_neg_ < pos)
{
this._grammar._parsingErrors._#_neg_ = pos;
}
}
return newPos2;
}
public _#prefix#__neg_(IGrammar grammar) : base('\0', '?')
{
this._grammar = (CalcParser.GrammarImpl)grammar;
}
}
public class _#postfix#_mul_ : ExtensionPostfixBase<ExprAst>
{
private readonly CalcParser.GrammarImpl _grammar;
public override RuleDescriptor Descriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_mul_.StaticDescriptor;
}
}
public override int Parse(int startPos, int pos, string text, int[] bestOffsets, ref ExprAst result)
{
bool isBest = false;
NToken token_2 = default(NToken);
ExprAst token_3 = null;
ExprAst prefixResult = result;
ExprAst token_4 = prefixResult;
bool _N_cache_9770 = pos >= 0;
bool arg_AA_0;
if (_N_cache_9770)
{
if (true)
{
if (isBest)
{
arg_AA_0 = true;
}
else
{
isBest = (bestOffsets[0] < pos);
arg_AA_0 = (isBest || bestOffsets[0] == pos);
}
goto IL_9F;
}
}
arg_AA_0 = false;
IL_9F:
int arg_36F_0;
if (arg_AA_0)
{
int arg_108_0;
if (pos < text.Length)
{
char c = text[pos];
arg_108_0 = ((c != '*') ? -1 : (pos + 1));
}
else
{
arg_108_0 = -1;
}
int newPos = arg_108_0;
if (newPos >= 0)
{
token_2 = new NToken(pos, newPos);
}
int pos2 = newPos;
bool _N_cache_9771 = pos2 >= 0;
bool arg_197_0;
if (_N_cache_9771)
{
if (true)
{
if (isBest)
{
arg_197_0 = true;
}
else
{
isBest = (bestOffsets[1] < pos2);
arg_197_0 = (isBest || bestOffsets[1] == pos2);
}
goto IL_18C;
}
}
arg_197_0 = false;
IL_18C:
if (arg_197_0)
{
int ofs = pos2;
int pos3 = this._grammar._#_s_(pos2, text);
bool _N_cache_9772 = pos3 >= 0;
bool arg_224_0;
if (_N_cache_9772)
{
if (true)
{
if (isBest)
{
arg_224_0 = true;
}
else
{
isBest = (bestOffsets[2] < pos3);
arg_224_0 = (isBest || bestOffsets[2] == pos3);
}
goto IL_219;
}
}
arg_224_0 = false;
IL_219:
if (arg_224_0)
{
int ofs2 = pos3;
int pos4 = this._grammar._#_expr_(pos3, text, 20, ref token_3);
bool _N_cache_9773 = pos4 >= 0;
bool arg_2B5_0;
if (_N_cache_9773)
{
if (true)
{
if (isBest)
{
arg_2B5_0 = true;
}
else
{
isBest = (bestOffsets[3] < pos4);
arg_2B5_0 = (isBest || bestOffsets[3] == pos4);
}
goto IL_2AA;
}
}
arg_2B5_0 = false;
IL_2AA:
if (arg_2B5_0)
{
int ofs3 = pos4;
if (isBest)
{
bestOffsets[0] = pos;
bestOffsets[1] = ofs;
bestOffsets[2] = ofs2;
bestOffsets[3] = ofs3;
int i = 4;
while (i < bestOffsets.Length && bestOffsets[i] >= 0)
{
bestOffsets[i] = -1;
i++;
}
arg_36F_0 = pos4;
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
int newPos2 = arg_36F_0;
if (newPos2 > 0)
{
result = new CalcParser.Expr.Mul(token_4, token_2, token_3);
result.Location = new Location(this._grammar._parsingSource, token_4.StartPos, token_3.EndPos);
}
else
{
if (this._grammar._parsingErrors._#_mul_ < pos)
{
this._grammar._parsingErrors._#_mul_ = pos;
}
}
return newPos2;
}
public _#postfix#_mul_(IGrammar grammar) : base(20, '\0', '?')
{
this._grammar = (CalcParser.GrammarImpl)grammar;
}
}
public class _#postfix#_mod_ : ExtensionPostfixBase<ExprAst>
{
private readonly CalcParser.GrammarImpl _grammar;
public override RuleDescriptor Descriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_mod_.StaticDescriptor;
}
}
public override int Parse(int startPos, int pos, string text, int[] bestOffsets, ref ExprAst result)
{
bool isBest = false;
NToken token_2 = default(NToken);
ExprAst token_3 = null;
ExprAst prefixResult = result;
ExprAst token_4 = prefixResult;
bool _N_cache_9893 = pos >= 0;
bool arg_AA_0;
if (_N_cache_9893)
{
if (true)
{
if (isBest)
{
arg_AA_0 = true;
}
else
{
isBest = (bestOffsets[0] < pos);
arg_AA_0 = (isBest || bestOffsets[0] == pos);
}
goto IL_9F;
}
}
arg_AA_0 = false;
IL_9F:
int arg_36F_0;
if (arg_AA_0)
{
int arg_108_0;
if (pos < text.Length)
{
char c = text[pos];
arg_108_0 = ((c != '%') ? -1 : (pos + 1));
}
else
{
arg_108_0 = -1;
}
int newPos = arg_108_0;
if (newPos >= 0)
{
token_2 = new NToken(pos, newPos);
}
int pos2 = newPos;
bool _N_cache_9894 = pos2 >= 0;
bool arg_197_0;
if (_N_cache_9894)
{
if (true)
{
if (isBest)
{
arg_197_0 = true;
}
else
{
isBest = (bestOffsets[1] < pos2);
arg_197_0 = (isBest || bestOffsets[1] == pos2);
}
goto IL_18C;
}
}
arg_197_0 = false;
IL_18C:
if (arg_197_0)
{
int ofs = pos2;
int pos3 = this._grammar._#_s_(pos2, text);
bool _N_cache_9895 = pos3 >= 0;
bool arg_224_0;
if (_N_cache_9895)
{
if (true)
{
if (isBest)
{
arg_224_0 = true;
}
else
{
isBest = (bestOffsets[2] < pos3);
arg_224_0 = (isBest || bestOffsets[2] == pos3);
}
goto IL_219;
}
}
arg_224_0 = false;
IL_219:
if (arg_224_0)
{
int ofs2 = pos3;
int pos4 = this._grammar._#_expr_(pos3, text, 20, ref token_3);
bool _N_cache_9896 = pos4 >= 0;
bool arg_2B5_0;
if (_N_cache_9896)
{
if (true)
{
if (isBest)
{
arg_2B5_0 = true;
}
else
{
isBest = (bestOffsets[3] < pos4);
arg_2B5_0 = (isBest || bestOffsets[3] == pos4);
}
goto IL_2AA;
}
}
arg_2B5_0 = false;
IL_2AA:
if (arg_2B5_0)
{
int ofs3 = pos4;
if (isBest)
{
bestOffsets[0] = pos;
bestOffsets[1] = ofs;
bestOffsets[2] = ofs2;
bestOffsets[3] = ofs3;
int i = 4;
while (i < bestOffsets.Length && bestOffsets[i] >= 0)
{
bestOffsets[i] = -1;
i++;
}
arg_36F_0 = pos4;
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
int newPos2 = arg_36F_0;
if (newPos2 > 0)
{
result = new CalcParser.Expr.Mod(token_4, token_2, token_3);
result.Location = new Location(this._grammar._parsingSource, token_4.StartPos, token_3.EndPos);
}
else
{
if (this._grammar._parsingErrors._#_mod_ < pos)
{
this._grammar._parsingErrors._#_mod_ = pos;
}
}
return newPos2;
}
public _#postfix#_mod_(IGrammar grammar) : base(20, '\0', '?')
{
this._grammar = (CalcParser.GrammarImpl)grammar;
}
}
public class _#postfix#_div_ : ExtensionPostfixBase<ExprAst>
{
private readonly CalcParser.GrammarImpl _grammar;
public override RuleDescriptor Descriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_div_.StaticDescriptor;
}
}
public override int Parse(int startPos, int pos, string text, int[] bestOffsets, ref ExprAst result)
{
bool isBest = false;
NToken token_2 = default(NToken);
ExprAst token_3 = null;
ExprAst prefixResult = result;
ExprAst token_4 = prefixResult;
bool _N_cache_10016 = pos >= 0;
bool arg_AA_0;
if (_N_cache_10016)
{
if (true)
{
if (isBest)
{
arg_AA_0 = true;
}
else
{
isBest = (bestOffsets[0] < pos);
arg_AA_0 = (isBest || bestOffsets[0] == pos);
}
goto IL_9F;
}
}
arg_AA_0 = false;
IL_9F:
int arg_36F_0;
if (arg_AA_0)
{
int arg_108_0;
if (pos < text.Length)
{
char c = text[pos];
arg_108_0 = ((c != '/') ? -1 : (pos + 1));
}
else
{
arg_108_0 = -1;
}
int newPos = arg_108_0;
if (newPos >= 0)
{
token_2 = new NToken(pos, newPos);
}
int pos2 = newPos;
bool _N_cache_10017 = pos2 >= 0;
bool arg_197_0;
if (_N_cache_10017)
{
if (true)
{
if (isBest)
{
arg_197_0 = true;
}
else
{
isBest = (bestOffsets[1] < pos2);
arg_197_0 = (isBest || bestOffsets[1] == pos2);
}
goto IL_18C;
}
}
arg_197_0 = false;
IL_18C:
if (arg_197_0)
{
int ofs = pos2;
int pos3 = this._grammar._#_s_(pos2, text);
bool _N_cache_10018 = pos3 >= 0;
bool arg_224_0;
if (_N_cache_10018)
{
if (true)
{
if (isBest)
{
arg_224_0 = true;
}
else
{
isBest = (bestOffsets[2] < pos3);
arg_224_0 = (isBest || bestOffsets[2] == pos3);
}
goto IL_219;
}
}
arg_224_0 = false;
IL_219:
if (arg_224_0)
{
int ofs2 = pos3;
int pos4 = this._grammar._#_expr_(pos3, text, 20, ref token_3);
bool _N_cache_10019 = pos4 >= 0;
bool arg_2B5_0;
if (_N_cache_10019)
{
if (true)
{
if (isBest)
{
arg_2B5_0 = true;
}
else
{
isBest = (bestOffsets[3] < pos4);
arg_2B5_0 = (isBest || bestOffsets[3] == pos4);
}
goto IL_2AA;
}
}
arg_2B5_0 = false;
IL_2AA:
if (arg_2B5_0)
{
int ofs3 = pos4;
if (isBest)
{
bestOffsets[0] = pos;
bestOffsets[1] = ofs;
bestOffsets[2] = ofs2;
bestOffsets[3] = ofs3;
int i = 4;
while (i < bestOffsets.Length && bestOffsets[i] >= 0)
{
bestOffsets[i] = -1;
i++;
}
arg_36F_0 = pos4;
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
int newPos2 = arg_36F_0;
if (newPos2 > 0)
{
result = new CalcParser.Expr.Div(token_4, token_2, token_3);
result.Location = new Location(this._grammar._parsingSource, token_4.StartPos, token_3.EndPos);
}
else
{
if (this._grammar._parsingErrors._#_div_ < pos)
{
this._grammar._parsingErrors._#_div_ = pos;
}
}
return newPos2;
}
public _#postfix#_div_(IGrammar grammar) : base(20, '\0', '?')
{
this._grammar = (CalcParser.GrammarImpl)grammar;
}
}
public class _#postfix#_add_ : ExtensionPostfixBase<ExprAst>
{
private readonly CalcParser.GrammarImpl _grammar;
public override RuleDescriptor Descriptor
{
get
{
return CalcParser.GrammarImpl.GrammarDescriptorImpl._#postfix#_add_.StaticDescriptor;
}
}
public override int Parse(int startPos, int pos, string text, int[] bestOffsets, ref ExprAst result)
{
bool isBest = false;
NToken token_2 = default(NToken);
ExprAst token_3 = null;
ExprAst prefixResult = result;
ExprAst token_4 = prefixResult;
bool _N_cache_10139 = pos >= 0;
bool arg_AA_0;
if (_N_cache_10139)
{
if (true)
{
if (isBest)
{
arg_AA_0 = true;
}
else
{
isBest = (bestOffsets[0] < pos);
arg_AA_0 = (isBest || bestOffsets[0] == pos);
}
goto IL_9F;
}
}
arg_AA_0 = false;
IL_9F:
int arg_36F_0;
if (arg_AA_0)
{
int arg_108_0;
if (pos < text.Length)
{
char c = text[pos];
arg_108_0 = ((c != '+') ? -1 : (pos + 1));
}
else
{
arg_108_0 = -1;
}
int newPos = arg_108_0;
if (newPos >= 0)
{
token_2 = new NToken(pos, newPos);
}
int pos2 = newPos;
bool _N_cache_10140 = pos2 >= 0;
bool arg_197_0;
if (_N_cache_10140)
{
if (true)
{
if (isBest)
{
arg_197_0 = true;
}
else
{
isBest = (bestOffsets[1] < pos2);
arg_197_0 = (isBest || bestOffsets[1] == pos2);
}
goto IL_18C;
}
}
arg_197_0 = false;
IL_18C:
if (arg_197_0)
{
int ofs = pos2;
int pos3 = this._grammar._#_s_(pos2, text);
bool _N_cache_10141 = pos3 >= 0;
bool arg_224_0;
if (_N_cache_10141)
{
if (true)
{
if (isBest)
{
arg_224_0 = true;
}
else
{
isBest = (bestOffsets[2] < pos3);
arg_224_0 = (isBest || bestOffsets[2] == pos3);
}
goto IL_219;
}
}
arg_224_0 = false;
IL_219:
if (arg_224_0)
{
int ofs2 = pos3;
int pos4 = this._grammar._#_expr_(pos3, text, 10, ref token_3);
bool _N_cache_10142 = pos4 >= 0;
bool arg_2B5_0;
if (_N_cache_10142)
{
if (true)
{
if (isBest)
{
arg_2B5_0 = true;
}
else
{
isBest = (bestOffsets[3] < pos4);
arg_2B5_0 = (isBest || bestOffsets[3] == pos4);
}
goto IL_2AA;
}
}
arg_2B5_0 = false;
IL_2AA:
if (arg_2B5_0)
{
int ofs3 = pos4;
if (isBest)
{
bestOffsets[0] = pos;
bestOffsets[1] = ofs;
bestOffsets[2] = ofs2;
bestOffsets[3] = ofs3;
int i = 4;
while (i < bestOffsets.Length && bestOffsets[i] >= 0)
{
bestOffsets[i] = -1;
i++;
}
arg_36F_0 = pos4;
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
}
else
{
arg_36F_0 = -1;
}
int newPos2 = arg_36F_0;
if (newPos2 > 0)
{
result = new CalcParser.Expr.Add(token_4, token_2, token_3);
result.Location = new Location(this._grammar._parsingSource, token_4.StartPos, token_3.EndPos);
}
else
{
if (this._grammar._parsingErrors._#_add_ < pos)
{
this._grammar._parsingErrors._#_add_ = pos;
}
}
return newPos2;
}
public _#postfix#_add_(IGrammar grammar) : base(10, '\0', '?')
{
this._grammar = (CalcParser.GrammarImpl)grammar;
}
}
private IncParser.GrammarImpl _#grammar#0;
private NumParser.GrammarImpl _#grammar#1;
public ExtensionPostfixBase<ExprAst>[] _#_expr_PostfixRules_ = new ExtensionPostfixBase<ExprAst>[0];
public ExtensionPrefixBase<ExprAst>[] _#_expr_PrefixRules__ = new ExtensionPrefixBase<ExprAst>[0];
private int _#_expr_PrefixEndPos_ = -1;
private ExprAst _#_expr_PrefixResult_;
private int _#_expr_EndPos_______ = -1;
private ExprAst _#_expr_Result_______;
private int _#_expr_BindingPower_ = -1;
private int _#_expr_StartPos_____ = -1;
private int _#_start_EndPos______ = -1;
private ExprAst _#_start_Result______;
private int _#_start_StartPos____ = -1;
[CompilerGenerated, DebuggerBrowsable(DebuggerBrowsableState.Never)]
private Parser _N_Parser_4066;
private CalcParser.GrammarImpl.ParsingErrorsImpl _parsingErrors;
private static readonly GrammarDescriptor _descriptor;
public override Parser Parser
{
get;
private set;
}
public static GrammarDescriptor StaticDescriptor
{
get
{
return CalcParser.GrammarImpl._descriptor;
}
}
public GrammarDescriptor Descriptor
{
get
{
return CalcParser.GrammarImpl._descriptor;
}
}
public new SourceSnapshot get_ParsingSource()
{
return base.ParsingSource;
}
public void Init()
{
this._parsingSource = this.Parser.ParsingSource;
this._parsingErrors = (CalcParser.GrammarImpl.ParsingErrorsImpl)this.Parser.GetParsingErrorsForGrammar(CalcParser.GrammarImpl.StaticDescriptor);
this._#grammar#1 = (NumParser.GrammarImpl)this.Parser.GetGrammar(NumParser.GrammarImpl.StaticDescriptor).Value;
this._#grammar#0 = (IncParser.GrammarImpl)this.Parser.GetGrammar(IncParser.GrammarImpl.StaticDescriptor).Value;
this.LoadExtensionRules();
}
public IGrammarState SaveState()
{
return new CalcParser.GrammarImpl.GrammarStateImpl(this);
}
private void LoadExtensionRules()
{
checked
{
ExtensionPrefixBase<ExprAst>[] e = this._#_expr_PrefixRules__;
int result = 0;
if (e != null)
{
result = e.Length;
}
int prevLength = result;
Array.Resize<ExtensionPrefixBase<ExprAst>>(ref this._#_expr_PrefixRules__, prevLength + 5);
this._#_expr_PrefixRules__[prevLength + 0] = new CalcParser.GrammarImpl._#prefix#__neg_(this);
this._#_expr_PrefixRules__[prevLength + 1] = new CalcParser.GrammarImpl._#prefix#__num_(this);
this._#_expr_PrefixRules__[prevLength + 2] = new CalcParser.GrammarImpl._#prefix#__prefixDec_(this);
this._#_expr_PrefixRules__[prevLength + 3] = new CalcParser.GrammarImpl._#prefix#__rounds_(this);
this._#_expr_PrefixRules__[prevLength + 4] = new CalcParser.GrammarImpl._#prefix#__seq_(this);
ExtensionPostfixBase<ExprAst>[] e2 = this._#_expr_PostfixRules_;
int result2 = 0;
if (e2 != null)
{
result2 = e2.Length;
}
prevLength = result2;
Array.Resize<ExtensionPostfixBase<ExprAst>>(ref this._#_expr_PostfixRules_, prevLength + 7);
this._#_expr_PostfixRules_[prevLength + 0] = new CalcParser.GrammarImpl._#postfix#_add_(this);
this._#_expr_PostfixRules_[prevLength + 1] = new CalcParser.GrammarImpl._#postfix#_div_(this);
this._#_expr_PostfixRules_[prevLength + 2] = new CalcParser.GrammarImpl._#postfix#_mod_(this);
this._#_expr_PostfixRules_[prevLength + 3] = new CalcParser.GrammarImpl._#postfix#_mul_(this);
this._#_expr_PostfixRules_[prevLength + 4] = new CalcParser.GrammarImpl._#postfix#_postfixDec_(this);
this._#_expr_PostfixRules_[prevLength + 5] = new CalcParser.GrammarImpl._#postfix#_pow_(this);
this._#_expr_PostfixRules_[prevLength + 6] = new CalcParser.GrammarImpl._#postfix#_sub_(this);
}
}
private void ResetMemoization()
{
this._#_start_StartPos____ = -1;
this._#_start_Result______ = null;
this._#_start_EndPos______ = -1;
this._#_expr_StartPos_____ = -1;
this._#_expr_BindingPower_ = -1;
this._#_expr_Result_______ = null;
this._#_expr_EndPos_______ = -1;
this._#_expr_PrefixResult_ = null;
this._#_expr_PrefixEndPos_ = -1;
}
public int _#_expr_(int pos, string text, int bindingPower)
{
ExprAst result = null;
return this._#_expr_(pos, text, bindingPower, ref result);
}
public int _#_expr_(int pos, string text, int bindingPower, ref ExprAst curResult)
{
int _N_return = 0;
int[] bestOffsets = new int[32];
int curEndPos = -1;
ExprAst newResult = null;
if (this._#_expr_StartPos_____ == pos)
{
if (this._#_expr_EndPos_______ < 0)
{
_N_return = -1;
return _N_return;
}
if (this._#_expr_BindingPower_ == bindingPower)
{
curResult = this._#_expr_Result_______;
_N_return = this._#_expr_EndPos_______;
return _N_return;
}
this._#_expr_BindingPower_ = bindingPower;
this._#_expr_EndPos_______ = -1;
curResult = this._#_expr_PrefixResult_;
curEndPos = this._#_expr_PrefixEndPos_;
}
else
{
this._#_expr_BindingPower_ = bindingPower;
this._#_expr_StartPos_____ = pos;
this._#_expr_PrefixEndPos_ = -1;
this._#_expr_EndPos_______ = -1;
int i = 0;
while (i < bestOffsets.Length && bestOffsets[i] >= 0)
{
bestOffsets[i] = -1;
i++;
}
if (pos < text.Length)
{
char c = text[pos];
ExtensionPrefixBase<ExprAst>[] #_expr_PrefixRules__ = this._#_expr_PrefixRules__;
for (int k = 0; k < #_expr_PrefixRules__.Length; k++)
{
ExtensionPrefixBase<ExprAst> extensionPrefixBase = #_expr_PrefixRules__[k];
ExtensionPrefixBase<ExprAst> prefixRule = (ExtensionPrefixBase<ExprAst>)extensionPrefixBase;
if (prefixRule.LowerBound <= c && c <= prefixRule.UpperBound)
{
int newEndPos = prefixRule.Parse(pos, text, bestOffsets, ref newResult);
if (newEndPos > 0)
{
curResult = newResult;
curEndPos = newEndPos;
}
}
}
}
else
{
ExtensionPrefixBase<ExprAst>[] #_expr_PrefixRules__2 = this._#_expr_PrefixRules__;
for (int l = 0; l < #_expr_PrefixRules__2.Length; l++)
{
ExtensionPrefixBase<ExprAst> extensionPrefixBase2 = #_expr_PrefixRules__2[l];
ExtensionPrefixBase<ExprAst> prefixRule2 = (ExtensionPrefixBase<ExprAst>)extensionPrefixBase2;
int newEndPos = prefixRule2.Parse(pos, text, bestOffsets, ref newResult);
if (newEndPos > 0)
{
curResult = newResult;
curEndPos = newEndPos;
}
}
}
}
if (curEndPos >= 0)
{
ExprAst prefixResult = curResult;
int prefixEndPos = curEndPos;
ExprAst bestResult = curResult;
int bestEndPos = curEndPos;
while (curEndPos < text.Length)
{
int j = 0;
while (j < bestOffsets.Length && bestOffsets[j] >= 0)
{
bestOffsets[j] = -1;
j++;
}
char c = text[curEndPos];
ExtensionPostfixBase<ExprAst>[] #_expr_PostfixRules_ = this._#_expr_PostfixRules_;
for (int m = 0; m < #_expr_PostfixRules_.Length; m++)
{
ExtensionPostfixBase<ExprAst> extensionPostfixBase = #_expr_PostfixRules_[m];
ExtensionPostfixBase<ExprAst> postfixRule = (ExtensionPostfixBase<ExprAst>)extensionPostfixBase;
if (postfixRule.LowerBound <= c && c <= postfixRule.UpperBound && bindingPower < postfixRule.BindingPower)
{
newResult = curResult;
int newEndPos = postfixRule.Parse(pos, curEndPos, text, bestOffsets, ref newResult);
if (newEndPos > 0)
{
bestEndPos = newEndPos;
bestResult = newResult;
}
}
}
if (bestEndPos == curEndPos)
{
IL_3A8:
this._#_expr_BindingPower_ = bindingPower;
this._#_expr_StartPos_____ = pos;
this._#_expr_PrefixResult_ = prefixResult;
this._#_expr_PrefixEndPos_ = prefixEndPos;
this._#_expr_Result_______ = curResult;
this._#_expr_EndPos_______ = curEndPos;
_N_return = curEndPos;
return _N_return;
}
curResult = bestResult;
curEndPos = bestEndPos;
}
goto IL_3A8;
}
_N_return = -1;
return _N_return;
}
public int _#_any_(int pos, string text)
{
return (pos >= text.Length) ? -1 : (pos + 1);
}
public int _#_start_(int pos, string text, ref ExprAst result)
{
ExprAst token_ = null;
int arg_1BA_0;
if (this._#_start_StartPos____ == pos)
{
if (this._#_start_EndPos______ >= 0)
{
result = this._#_start_Result______;
}
arg_1BA_0 = this._#_start_EndPos______;
}
else
{
int pos2 = this._#_s_(pos, text);
int arg_12C_0;
if (pos2 >= 0)
{
int pos3 = this._#_expr_(pos2, text, 0, ref token_);
if (pos3 >= 0)
{
int newPos = this._#_any_(pos3, text);
int pos4 = (newPos >= 0) ? -1 : pos3;
arg_12C_0 = ((pos4 < 0) ? -1 : pos4);
}
else
{
arg_12C_0 = -1;
}
}
else
{
arg_12C_0 = -1;
}
int newPos2 = arg_12C_0;
this._#_start_StartPos____ = pos;
this._#_start_EndPos______ = newPos2;
if (newPos2 >= 0)
{
result = token_;
result.Location = new Location(this._parsingSource, token_.StartPos, token_.EndPos);
this._#_start_Result______ = result;
}
else
{
if (this._parsingErrors._#_start_ < pos)
{
this._parsingErrors._#_start_ = pos;
}
}
arg_1BA_0 = newPos2;
}
return arg_1BA_0;
}
public int _#_s_(int pos, string text)
{
int num = pos;
while (true)
{
int arg_6A_0;
if (num < text.Length)
{
char c = text[num];
arg_6A_0 = ((c != ' ') ? -1 : (num + 1));
}
else
{
arg_6A_0 = -1;
}
int newPos = arg_6A_0;
if (newPos < 0)
{
break;
}
num = newPos;
}
return num;
}
static GrammarImpl()
{
CalcParser.GrammarImpl._descriptor = new CalcParser.GrammarImpl.GrammarDescriptorImpl();
}
public GrammarImpl()
{
}
public GrammarImpl(Parser parser)
{
if (parser == null)
{
throw new ArgumentNullException("parser", "The ``NotNull'' contract of parameter ``parser'' has been violated. See Main.n:17:2:49:2: .");
}
this.Parser = parser;
}
public override Nemerle.Builtins.Tuple<int, ExprAst> TryParseExpr(SourceSnapshot source)
{
checked
{
if (source == null)
{
throw new ArgumentNullException("source", "The ``NotNull'' contract of parameter ``source'' has been violated. See Main.n:17:2:49:2: .");
}
this.ResetMemoization();
this.Parser = new Parser(this, source);
GrammarDescriptor[] dependencies = this.Descriptor.Dependencies;
for (int i = 0; i < dependencies.Length; i++)
{
GrammarDescriptor grammarDescriptor = dependencies[i];
GrammarDescriptor descriptor = grammarDescriptor;
this.Parser.AddGrammar(descriptor);
}
this.Init();
ExprAst result = null;
int pos = this._#_expr_(0, this._parsingSource.Text, 0, ref result);
return new Nemerle.Builtins.Tuple<int, ExprAst>(pos, result);
}
}
public override Nemerle.Builtins.Tuple<int, ExprAst> TryParseStart(SourceSnapshot source)
{
checked
{
if (source == null)
{
throw new ArgumentNullException("source", "The ``NotNull'' contract of parameter ``source'' has been violated. See Main.n:17:2:49:2: .");
}
this.ResetMemoization();
this.Parser = new Parser(this, source);
GrammarDescriptor[] dependencies = this.Descriptor.Dependencies;
for (int i = 0; i < dependencies.Length; i++)
{
GrammarDescriptor grammarDescriptor = dependencies[i];
GrammarDescriptor descriptor = grammarDescriptor;
this.Parser.AddGrammar(descriptor);
}
this.Init();
ExprAst result = null;
int pos = this._#_start_(0, this._parsingSource.Text, ref result);
return new Nemerle.Builtins.Tuple<int, ExprAst>(pos, result);
}
}
}
[Variant("CalcParser.Expr.Sub,CalcParser.Expr.Seq,CalcParser.Expr.Rounds,CalcParser.Expr.PrefixDec,CalcParser.Expr.Pow,CalcParser.Expr.PostfixDec,CalcParser.Expr.Num,CalcParser.Expr.Neg,CalcParser.Expr.Mul,CalcParser.Expr.Mod,CalcParser.Expr.Div,CalcParser.Expr.Add")]
public abstract class Expr : ExprAst
{
[VariantOption]
public class Add : CalcParser.Expr
{
public readonly ExprAst l;
public readonly NToken op;
public readonly ExprAst r;
public override int _N_GetVariantCode()
{
return 0;
}
public Add()
{
}
public Add(ExprAst l, NToken op, ExprAst r)
{
this.l = l;
this.op = op;
this.r = r;
}
}
[VariantOption]
public class Div : CalcParser.Expr
{
public readonly ExprAst l;
public readonly NToken op;
public readonly ExprAst r;
public override int _N_GetVariantCode()
{
return 1;
}
public Div()
{
}
public Div(ExprAst l, NToken op, ExprAst r)
{
this.l = l;
this.op = op;
this.r = r;
}
}
[VariantOption]
public class Mod : CalcParser.Expr
{
public readonly ExprAst l;
public readonly NToken op;
public readonly ExprAst r;
public override int _N_GetVariantCode()
{
return 2;
}
public Mod()
{
}
public Mod(ExprAst l, NToken op, ExprAst r)
{
this.l = l;
this.op = op;
this.r = r;
}
}
[VariantOption]
public class Mul : CalcParser.Expr
{
public readonly ExprAst l;
public readonly NToken op;
public readonly ExprAst r;
public override int _N_GetVariantCode()
{
return 3;
}
public Mul()
{
}
public Mul(ExprAst l, NToken op, ExprAst r)
{
this.l = l;
this.op = op;
this.r = r;
}
}
[VariantOption]
public class Neg : CalcParser.Expr
{
public readonly NToken op;
public readonly ExprAst expr;
public override int _N_GetVariantCode()
{
return 4;
}
public Neg()
{
}
public Neg(NToken op, ExprAst expr)
{
this.op = op;
this.expr = expr;
}
}
[VariantOption]
public class Num : CalcParser.Expr
{
public readonly string num;
public override int _N_GetVariantCode()
{
return 5;
}
public Num()
{
}
public Num(string num)
{
this.num = num;
}
}
[VariantOption]
public class PostfixDec : CalcParser.Expr
{
public readonly ExprAst expr;
public readonly NToken op;
public override int _N_GetVariantCode()
{
return 6;
}
public PostfixDec()
{
}
public PostfixDec(ExprAst expr, NToken op)
{
this.expr = expr;
this.op = op;
}
}
[VariantOption]
public class Pow : CalcParser.Expr
{
public readonly ExprAst l;
public readonly NToken op;
public readonly ExprAst r;
public override int _N_GetVariantCode()
{
return 7;
}
public Pow()
{
}
public Pow(ExprAst l, NToken op, ExprAst r)
{
this.l = l;
this.op = op;
this.r = r;
}
}
[VariantOption]
public class PrefixDec : CalcParser.Expr
{
public readonly NToken op;
public readonly ExprAst expr;
public override int _N_GetVariantCode()
{
return 8;
}
public PrefixDec()
{
}
public PrefixDec(NToken op, ExprAst expr)
{
this.op = op;
this.expr = expr;
}
}
[VariantOption]
public class Rounds : CalcParser.Expr
{
public readonly NToken l;
public readonly ExprAst expr;
public readonly NToken r;
public override int _N_GetVariantCode()
{
return 9;
}
public Rounds()
{
}
public Rounds(NToken l, ExprAst expr, NToken r)
{
this.l = l;
this.expr = expr;
this.r = r;
}
}
[VariantOption]
public class Seq : CalcParser.Expr
{
public readonly NToken l;
public readonly list<ExprAst> expr;
public readonly NToken r;
public override int _N_GetVariantCode()
{
return 10;
}
public Seq()
{
}
public Seq(NToken l, list<ExprAst> expr, NToken r)
{
this.l = l;
this.expr = expr;
this.r = r;
}
}
[VariantOption]
public class Sub : CalcParser.Expr
{
public readonly ExprAst l;
public readonly NToken op;
public readonly ExprAst r;
public override int _N_GetVariantCode()
{
return 11;
}
public Sub()
{
}
public Sub(ExprAst l, NToken op, ExprAst r)
{
this.l = l;
this.op = op;
this.r = r;
}
}
public abstract override int _N_GetVariantCode();
public static int _N_GetVariantCodeSafe(CalcParser.Expr x)
{
return ((object)x != null) ? x._N_GetVariantCode() : -1;
}
public static int _N_GetVariantCodeObject(object x)
{
int arg_1E_0;
if (x is CalcParser.Expr)
{
CalcParser.Expr expr = (CalcParser.Expr)x;
arg_1E_0 = expr._N_GetVariantCode();
}
else
{
arg_1E_0 = -1;
}
return arg_1E_0;
}
}
private SourceSnapshot _parsingSource;
public abstract override Parser Parser
{
get;
}
public SourceSnapshot ParsingSource
{
get
{
return this._parsingSource;
}
}
public string GetText(NToken tok)
{
return this._parsingSource.OriginalText.Substring(tok.StartPos, checked(tok.EndPos - tok.StartPos));
}
public Location GetLocation(NToken tok)
{
return new Location(this._parsingSource, tok.StartPos, tok.EndPos);
}
public option<ExprAst> ParseExpr(string text)
{
Nemerle.Builtins.Tuple<int, ExprAst> _N_cache_5180 = this.TryParseExpr(text);
int pos = _N_cache_5180.Field0;
ExprAst res = _N_cache_5180.Field1;
return (pos >= 0) ? new option<ExprAst>.Some(res) : option<ExprAst>.None._N_constant_object;
}
public option<ExprAst> ParseExpr(SourceSnapshot source)
{
Nemerle.Builtins.Tuple<int, ExprAst> _N_cache_5193 = this.TryParseExpr(source);
int pos = _N_cache_5193.Field0;
ExprAst res = _N_cache_5193.Field1;
return (pos >= 0) ? new option<ExprAst>.Some(res) : option<ExprAst>.None._N_constant_object;
}
public Nemerle.Builtins.Tuple<int, ExprAst> TryParseExpr(string text)
{
return this.TryParseExpr(new SourceSnapshot(text, 0, ""));
}
public abstract override Nemerle.Builtins.Tuple<int, ExprAst> TryParseExpr(SourceSnapshot source);
public option<ExprAst> ParseStart(string text)
{
Nemerle.Builtins.Tuple<int, ExprAst> _N_cache_5210 = this.TryParseStart(text);
int pos = _N_cache_5210.Field0;
ExprAst res = _N_cache_5210.Field1;
return (pos >= 0) ? new option<ExprAst>.Some(res) : option<ExprAst>.None._N_constant_object;
}
public option<ExprAst> ParseStart(SourceSnapshot source)
{
Nemerle.Builtins.Tuple<int, ExprAst> _N_cache_5223 = this.TryParseStart(source);
int pos = _N_cache_5223.Field0;
ExprAst res = _N_cache_5223.Field1;
return (pos >= 0) ? new option<ExprAst>.Some(res) : option<ExprAst>.None._N_constant_object;
}
public Nemerle.Builtins.Tuple<int, ExprAst> TryParseStart(string text)
{
return this.TryParseStart(new SourceSnapshot(text, 0, ""));
}
public abstract override Nemerle.Builtins.Tuple<int, ExprAst> TryParseStart(SourceSnapshot source);
}
|