//public bool IsSymbol{get{return !Char.IsLetter( Symbol[0]);}} public override void Compile(RuleCompiler cmp) { base.Compile(cmp); if (Symbol.ToCharArray().All(Char.IsLetter)) { TerminalPosName = cmp.AllocVar(Symbol.Capitalize() + "Pos", "TermPos", "SymbolPosition", VariableTypeGroup.SymbolPos); } else { TerminalPosName = cmp.AllocVar(null, "TermPos", "SymbolPosition", VariableTypeGroup.SymbolPos); } }
public override void Compile(RuleCompiler cmp) { base.Compile(cmp); Rule target = cmp.Rules.FindRule(RefName); MemberNodeName = cmp.AllocVar(target.CodeName + "Node", "SubNode", target.GetResultType(), VariableTypeGroup.SubNode); }
public override void Compile(RuleCompiler cmp) { base.Compile(cmp); if (!Mandatory) { if (CodeId != null) { IsVariable = cmp.AllocVar("Is" + CodeId, null, "bool", VariableTypeGroup.Bool); } else { IsVariable = cmp.AllocVar(null, "IsItem", "bool", VariableTypeGroup.Bool); } } if (CodeId != null) { EnumTypeName = cmp.AllocLocalType(CodeId + "ModeType", null); } else { EnumTypeName = cmp.AllocLocalType(null, "ModeType"); } if (CodeId != null) { EnumVarName = cmp.AllocVar(CodeId + "Mode", null, cmp.Rule.GetResultType() + "." + EnumTypeName, VariableTypeGroup.ModeEnum); } else { EnumVarName = cmp.AllocVar(null, "Mode", cmp.Rule.GetResultType() + "." + EnumTypeName, VariableTypeGroup.ModeEnum); } foreach (var chain in Chains) { string sug = chain.SuggestCodeId(); if (sug == "" || EnumElems.Contains(sug)) { sug = String.Format("Element_{0}", EnumElems.Count + 1); } EnumElems.Add(sug); } foreach (var chain in Chains) { chain.Compile(cmp); } }