/**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public override void Child(Production node, Node child)
 {
     switch (node.Id) {
     case (int) IrfConstants.IRF_DOCUMENT:
         ChildIrfDocument(node, child);
         break;
     case (int) IrfConstants.ROOT_NODE:
         ChildRootNode(node, child);
         break;
     case (int) IrfConstants.USER_NODE:
         ChildUserNode(node, child);
         break;
     case (int) IrfConstants.PLAYER_NOTE_NODE:
         ChildPlayerNoteNode(node, child);
         break;
     case (int) IrfConstants.PLAYER_NAME_ATTRIBUTE:
         ChildPlayerNameAttribute(node, child);
         break;
     case (int) IrfConstants.NOTE_TEXT_ATTRIBUTE:
         ChildNoteTextAttribute(node, child);
         break;
     case (int) IrfConstants.TIMESTAMP_ATTRIBUTE:
         ChildTimestampAttribute(node, child);
         break;
     case (int) IrfConstants.CLASSIFICATION_ATTRIBUTE:
         ChildClassificationAttribute(node, child);
         break;
     }
 }
Example #2
0
        /**
         * Analyzes a parse tree node by traversing all it's child nodes.
         * The tree traversal is depth-first, and the appropriate
         * callback methods will be called. If the node is a production
         * node, a new production node will be created and children will
         * be added by recursively processing the children of the
         * specified production node. This method is used to process a
         * parse tree after creation.
         *
         * @param node           the parse tree node to process
         *
         * @return the resulting parse tree node
         *
         * @throws ParserLogException if the node analysis discovered
         *             errors
         */
        public Node Analyze(Node node) {
            ParserLogException  log = new ParserLogException();

            node = Analyze(node, log);
            if (log.Count > 0) {
                throw log;
            }
            return node;
        }
Example #3
0
		public override void Enter(Node node)
		{
            switch ((ExpressionConstants)node.Id)
            {
				case ExpressionConstants.MEMBER_EXPRESSION:
					this.EnterMemberExpression();
					break;
				case ExpressionConstants.FIELD_PROPERTY_EXPRESSION:
					this.EnterFieldPropertyExpression();
					break;
			}
		}
Example #4
0
 /**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public override void Child(Production node, Node child)
 {
     switch (node.Id) {
     case (int) CommandGrammarConstants.COMMANDS:
         ChildCommands(node, child);
         break;
     case (int) CommandGrammarConstants.COMMAND:
         ChildCommand(node, child);
         break;
     case (int) CommandGrammarConstants.EXPRESSION:
         ChildExpression(node, child);
         break;
     }
 }
Example #5
0
		public override Node Exit(Node node)
		{
            switch ((ExpressionConstants)node.Id)
            {
				case ExpressionConstants.IDENTIFIER:
					this.ExitIdentifier((Token)node);
					break;
				case ExpressionConstants.FIELD_PROPERTY_EXPRESSION:
					this.ExitFieldPropertyExpression();
					break;
			}

			return node;
		}
Example #6
0
        public STBlock(Node blockLiteral, Context context, Compiler compiler)
        {
            Compiler = compiler;
            OuterContext = context;
            Context = new LocalContext(context, true);

            BlockLiteral = blockLiteral;
            BlockArgumentNames = new string[0];
            LocalVariableNames = new string[0];

            int i = 1;

            Node blockParams = null;

            if (blockLiteral[i].Name == "block_params")
                blockParams = blockLiteral[i++];

            if (blockLiteral[i].Name == "sequence") {
                Sequence = blockLiteral[i++];

                if (Sequence[0].Name == "var_def") {
                    List<string> varNames = new List<string>();
                    var vardef = Sequence[0];
                    for (int j = 1, max = vardef.Count; j < max; ++j) {
                        if (vardef[j].Name == "VAR_DELIM") break;
                        var varName = (vardef[j] as Token).Image;
                        varNames.Add (varName);
                        Context.Declare(varName);
                    }

                    LocalVariableNames = varNames.ToArray();
                }
            }

            if (blockParams != null) {
                var parms = blockParams;
                List<string> parmNames = new List<string>();
                for (int j = 0, max = parms.Count; j < max; ++j) {
                    var child = parms[j];
                    if (child.Name == "VAR_DELIM")
                        break;
                    var parmName = (parms[++j] as Token).Image;
                    parmNames.Add (parmName);
                    Context.Declare(parmName);
                }

                BlockArgumentNames = parmNames.ToArray();
            }
        }
Example #7
0
        private static Formule formuleFromPred(Node pred)
        {
            Node actualPred = pred.GetChildAt(0);
            String strPred = formule_str.Substring(actualPred.StartColumn - 1, actualPred.EndColumn - actualPred.StartColumn + 1);
            List<Formule> args = new List<Formule>();

            if (String.Equals(pred.Name, "PRED1"))
            {
                Node arg1 = pred.GetChildAt(2).GetChildAt(0);

                args.Add(new Formule(
                    String.Equals(arg1.Name, "VAR") ? Formule.Formule_Type.variable : Formule.Formule_Type.constante,
                    "" + formule_str[arg1.StartColumn - 1], null));
                return new Formule(Formule.Formule_Type.predicat, strPred, args);
            }
            else if(String.Equals(pred.Name, "PRED2"))
            {
                Node arg1 = pred.GetChildAt(2).GetChildAt(0);
                Node arg2 = pred.GetChildAt(4).GetChildAt(0);

                args.Add(new Formule(
                    String.Equals(arg1.Name, "VAR") ? Formule.Formule_Type.variable : Formule.Formule_Type.constante,
                    "" + formule_str[arg1.StartColumn-1], null));
                args.Add(new Formule(
                    String.Equals(arg2.Name, "VAR") ? Formule.Formule_Type.variable : Formule.Formule_Type.constante,
                    "" + formule_str[arg2.StartColumn-1], null));
                return new Formule(Formule.Formule_Type.predicat, strPred, args);
            }
            else /* PRED3 */
            {
                Node arg1 = pred.GetChildAt(2).GetChildAt(0);
                Node arg2 = pred.GetChildAt(4).GetChildAt(0);
                Node arg3 = pred.GetChildAt(6).GetChildAt(0);

                args.Add(new Formule(
                   String.Equals(arg1.Name, "VAR") ? Formule.Formule_Type.variable : Formule.Formule_Type.constante,
                   "" + formule_str[arg1.StartColumn - 1], null));
                args.Add(new Formule(
                    String.Equals(arg2.Name, "VAR") ? Formule.Formule_Type.variable : Formule.Formule_Type.constante,
                    "" + formule_str[arg2.StartColumn - 1], null));
                args.Add(new Formule(
                    String.Equals(arg3.Name, "VAR") ? Formule.Formule_Type.variable : Formule.Formule_Type.constante,
                    "" + formule_str[arg3.StartColumn - 1], null));
                return new Formule(Formule.Formule_Type.predicat, strPred, args);

            }
        }
Example #8
0
 /**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public virtual void ChildBranch(Production node, Node child)
 {
     node.AddChild(child);
 }
 /**
  * <summary>Called when entering a parse tree node.</summary>
  *
  * <param name='node'>the node being entered</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public override void Enter(Node node)
 {
     switch (node.Id) {
     case (int) IrfConstants.LT:
         EnterLt((Token) node);
         break;
     case (int) IrfConstants.GT:
         EnterGt((Token) node);
         break;
     case (int) IrfConstants.EQUAL:
         EnterEqual((Token) node);
         break;
     case (int) IrfConstants.QUOTE:
         EnterQuote((Token) node);
         break;
     case (int) IrfConstants.PLAYER_NOTES:
         EnterPlayerNotes((Token) node);
         break;
     case (int) IrfConstants.PLAYER_NOTE_SET:
         EnterPlayerNoteSet((Token) node);
         break;
     case (int) IrfConstants.USER_NAME:
         EnterUserName((Token) node);
         break;
     case (int) IrfConstants.PLAYER_NOTE:
         EnterPlayerNote((Token) node);
         break;
     case (int) IrfConstants.PLAYER_NAME:
         EnterPlayerName((Token) node);
         break;
     case (int) IrfConstants.NOTE_TEXT:
         EnterNoteText((Token) node);
         break;
     case (int) IrfConstants.TIMESTAMP:
         EnterTimestamp((Token) node);
         break;
     case (int) IrfConstants.CLASSIFICATION:
         EnterClassification((Token) node);
         break;
     case (int) IrfConstants.NUMBER:
         EnterNumber((Token) node);
         break;
     case (int) IrfConstants.QUOTED_STRING:
         EnterQuotedString((Token) node);
         break;
     case (int) IrfConstants.IDENTIFIER:
         EnterIdentifier((Token) node);
         break;
     case (int) IrfConstants.IRF_DOCUMENT:
         EnterIrfDocument((Production) node);
         break;
     case (int) IrfConstants.ROOT_NODE:
         EnterRootNode((Production) node);
         break;
     case (int) IrfConstants.USER_NODE:
         EnterUserNode((Production) node);
         break;
     case (int) IrfConstants.PLAYER_NOTE_NODE:
         EnterPlayerNoteNode((Production) node);
         break;
     case (int) IrfConstants.PLAYER_NAME_ATTRIBUTE:
         EnterPlayerNameAttribute((Production) node);
         break;
     case (int) IrfConstants.NOTE_TEXT_ATTRIBUTE:
         EnterNoteTextAttribute((Production) node);
         break;
     case (int) IrfConstants.TIMESTAMP_ATTRIBUTE:
         EnterTimestampAttribute((Production) node);
         break;
     case (int) IrfConstants.CLASSIFICATION_ATTRIBUTE:
         EnterClassificationAttribute((Production) node);
         break;
     }
 }
 /**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public virtual void ChildUserNode(Production node, Node child)
 {
     node.AddChild(child);
 }
 /**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public virtual void ChildTimestampAttribute(Production node, Node child)
 {
     node.AddChild(child);
 }
Example #12
0
 /**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public virtual void ChildLines(Production node, Node child)
 {
     node.AddChild(child);
 }
Example #13
0
 /**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public virtual void ChildOrigin(Production node, Node child)
 {
     node.AddChild(child);
 }
Example #14
0
 /**
  * Sets the parent node.
  *
  * @param parent         the new parent node
  */
 internal void SetParent(Node parent) {
     this.parent = parent;
 }
 /**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public virtual void ChildIrfDocument(Production node, Node child)
 {
     node.AddChild(child);
 }
Example #16
0
 /**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public virtual void ChildSymbols(Production node, Node child)
 {
     node.AddChild(child);
 }
Example #17
0
 /**
  * <summary>Called when entering a parse tree node.</summary>
  *
  * <param name='node'>the node being entered</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public override void Enter(Node node)
 {
     switch (node.Id) {
     case (int) PicoConstants.MOV:
         EnterMov((Token) node);
         break;
     case (int) PicoConstants.ADD:
         EnterAdd((Token) node);
         break;
     case (int) PicoConstants.SUB:
         EnterSub((Token) node);
         break;
     case (int) PicoConstants.MUL:
         EnterMul((Token) node);
         break;
     case (int) PicoConstants.DIV:
         EnterDiv((Token) node);
         break;
     case (int) PicoConstants.BEQ:
         EnterBeq((Token) node);
         break;
     case (int) PicoConstants.BGT:
         EnterBgt((Token) node);
         break;
     case (int) PicoConstants.IN:
         EnterIn((Token) node);
         break;
     case (int) PicoConstants.OUT:
         EnterOut((Token) node);
         break;
     case (int) PicoConstants.JSR:
         EnterJsr((Token) node);
         break;
     case (int) PicoConstants.RTS:
         EnterRts((Token) node);
         break;
     case (int) PicoConstants.STOP:
         EnterStop((Token) node);
         break;
     case (int) PicoConstants.ORG:
         EnterOrg((Token) node);
         break;
     case (int) PicoConstants.EQUALS:
         EnterEquals((Token) node);
         break;
     case (int) PicoConstants.LEFT_PAREN:
         EnterLeftParen((Token) node);
         break;
     case (int) PicoConstants.RIGHT_PAREN:
         EnterRightParen((Token) node);
         break;
     case (int) PicoConstants.HASH:
         EnterHash((Token) node);
         break;
     case (int) PicoConstants.COLON:
         EnterColon((Token) node);
         break;
     case (int) PicoConstants.COMMA:
         EnterComma((Token) node);
         break;
     case (int) PicoConstants.SIGN:
         EnterSign((Token) node);
         break;
     case (int) PicoConstants.NUMBER:
         EnterNumber((Token) node);
         break;
     case (int) PicoConstants.IDENTIFIER:
         EnterIdentifier((Token) node);
         break;
     case (int) PicoConstants.ENTER:
         EnterEnter((Token) node);
         break;
     case (int) PicoConstants.PROGRAM:
         EnterProgram((Production) node);
         break;
     case (int) PicoConstants.SEPARATOR:
         EnterSeparator((Production) node);
         break;
     case (int) PicoConstants.SYMBOLS:
         EnterSymbols((Production) node);
         break;
     case (int) PicoConstants.SYMBOL:
         EnterSymbol((Production) node);
         break;
     case (int) PicoConstants.INTEGER:
         EnterInteger((Production) node);
         break;
     case (int) PicoConstants.ORIGIN:
         EnterOrigin((Production) node);
         break;
     case (int) PicoConstants.LINES:
         EnterLines((Production) node);
         break;
     case (int) PicoConstants.LINE:
         EnterLine((Production) node);
         break;
     case (int) PicoConstants.INSTRUCTION:
         EnterInstruction((Production) node);
         break;
     case (int) PicoConstants.MOVE:
         EnterMove((Production) node);
         break;
     case (int) PicoConstants.ARITHMETIC:
         EnterArithmetic((Production) node);
         break;
     case (int) PicoConstants.BRANCH:
         EnterBranch((Production) node);
         break;
     case (int) PicoConstants.IO:
         EnterIo((Production) node);
         break;
     case (int) PicoConstants.CALL:
         EnterCall((Production) node);
         break;
     case (int) PicoConstants.RETURN:
         EnterReturn((Production) node);
         break;
     case (int) PicoConstants.END:
         EnterEnd((Production) node);
         break;
     case (int) PicoConstants.MOVE_ARGS:
         EnterMoveArgs((Production) node);
         break;
     case (int) PicoConstants.ARITHMETIC_ARGS:
         EnterArithmeticArgs((Production) node);
         break;
     case (int) PicoConstants.BRANCH_ARGS:
         EnterBranchArgs((Production) node);
         break;
     case (int) PicoConstants.IOARGS:
         EnterIoargs((Production) node);
         break;
     case (int) PicoConstants.END_ARGS:
         EnterEndArgs((Production) node);
         break;
     case (int) PicoConstants.ARG12:
         EnterArg12((Production) node);
         break;
     case (int) PicoConstants.ARG34:
         EnterArg34((Production) node);
         break;
     case (int) PicoConstants.ARG123:
         EnterArg123((Production) node);
         break;
     case (int) PicoConstants.ARG1234:
         EnterArg1234((Production) node);
         break;
     case (int) PicoConstants.ARG1:
         EnterArg1((Production) node);
         break;
     case (int) PicoConstants.ARG2:
         EnterArg2((Production) node);
         break;
     case (int) PicoConstants.ARG3:
         EnterArg3((Production) node);
         break;
     case (int) PicoConstants.ARG4:
         EnterArg4((Production) node);
         break;
     }
 }
Example #18
0
 /**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public virtual void ChildSeparator(Production node, Node child)
 {
     node.AddChild(child);
 }
Example #19
0
 /**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public virtual void ChildReturn(Production node, Node child)
 {
     node.AddChild(child);
 }
Example #20
0
 /**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public virtual void ChildProgram(Production node, Node child)
 {
     node.AddChild(child);
 }
 /**
  * <summary>Called when exiting a parse tree node.</summary>
  *
  * <param name='node'>the node being exited</param>
  *
  * <returns>the node to add to the parse tree, or
  *          null if no parse tree should be created</returns>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public override Node Exit(Node node)
 {
     switch (node.Id) {
     case (int) IrfConstants.LT:
         return ExitLt((Token) node);
     case (int) IrfConstants.GT:
         return ExitGt((Token) node);
     case (int) IrfConstants.EQUAL:
         return ExitEqual((Token) node);
     case (int) IrfConstants.QUOTE:
         return ExitQuote((Token) node);
     case (int) IrfConstants.PLAYER_NOTES:
         return ExitPlayerNotes((Token) node);
     case (int) IrfConstants.PLAYER_NOTE_SET:
         return ExitPlayerNoteSet((Token) node);
     case (int) IrfConstants.USER_NAME:
         return ExitUserName((Token) node);
     case (int) IrfConstants.PLAYER_NOTE:
         return ExitPlayerNote((Token) node);
     case (int) IrfConstants.PLAYER_NAME:
         return ExitPlayerName((Token) node);
     case (int) IrfConstants.NOTE_TEXT:
         return ExitNoteText((Token) node);
     case (int) IrfConstants.TIMESTAMP:
         return ExitTimestamp((Token) node);
     case (int) IrfConstants.CLASSIFICATION:
         return ExitClassification((Token) node);
     case (int) IrfConstants.NUMBER:
         return ExitNumber((Token) node);
     case (int) IrfConstants.QUOTED_STRING:
         return ExitQuotedString((Token) node);
     case (int) IrfConstants.IDENTIFIER:
         return ExitIdentifier((Token) node);
     case (int) IrfConstants.IRF_DOCUMENT:
         return ExitIrfDocument((Production) node);
     case (int) IrfConstants.ROOT_NODE:
         return ExitRootNode((Production) node);
     case (int) IrfConstants.USER_NODE:
         return ExitUserNode((Production) node);
     case (int) IrfConstants.PLAYER_NOTE_NODE:
         return ExitPlayerNoteNode((Production) node);
     case (int) IrfConstants.PLAYER_NAME_ATTRIBUTE:
         return ExitPlayerNameAttribute((Production) node);
     case (int) IrfConstants.NOTE_TEXT_ATTRIBUTE:
         return ExitNoteTextAttribute((Production) node);
     case (int) IrfConstants.TIMESTAMP_ATTRIBUTE:
         return ExitTimestampAttribute((Production) node);
     case (int) IrfConstants.CLASSIFICATION_ATTRIBUTE:
         return ExitClassificationAttribute((Production) node);
     }
     return node;
 }
Example #22
0
 void IBlockVisitor.VisitStatement(Node statement)
 {
     Compiler.EvaluateStatement(statement, Context);
 }
 /**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public virtual void ChildClassificationAttribute(Production node, Node child)
 {
     node.AddChild(child);
 }
Example #24
0
 /**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public virtual void ChildMoveArgs(Production node, Node child)
 {
     node.AddChild(child);
 }
Example #25
0
 /**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public override void Child(Production node, Node child)
 {
     switch (node.Id) {
     case (int) PicoConstants.PROGRAM:
         ChildProgram(node, child);
         break;
     case (int) PicoConstants.SEPARATOR:
         ChildSeparator(node, child);
         break;
     case (int) PicoConstants.SYMBOLS:
         ChildSymbols(node, child);
         break;
     case (int) PicoConstants.SYMBOL:
         ChildSymbol(node, child);
         break;
     case (int) PicoConstants.INTEGER:
         ChildInteger(node, child);
         break;
     case (int) PicoConstants.ORIGIN:
         ChildOrigin(node, child);
         break;
     case (int) PicoConstants.LINES:
         ChildLines(node, child);
         break;
     case (int) PicoConstants.LINE:
         ChildLine(node, child);
         break;
     case (int) PicoConstants.INSTRUCTION:
         ChildInstruction(node, child);
         break;
     case (int) PicoConstants.MOVE:
         ChildMove(node, child);
         break;
     case (int) PicoConstants.ARITHMETIC:
         ChildArithmetic(node, child);
         break;
     case (int) PicoConstants.BRANCH:
         ChildBranch(node, child);
         break;
     case (int) PicoConstants.IO:
         ChildIo(node, child);
         break;
     case (int) PicoConstants.CALL:
         ChildCall(node, child);
         break;
     case (int) PicoConstants.RETURN:
         ChildReturn(node, child);
         break;
     case (int) PicoConstants.END:
         ChildEnd(node, child);
         break;
     case (int) PicoConstants.MOVE_ARGS:
         ChildMoveArgs(node, child);
         break;
     case (int) PicoConstants.ARITHMETIC_ARGS:
         ChildArithmeticArgs(node, child);
         break;
     case (int) PicoConstants.BRANCH_ARGS:
         ChildBranchArgs(node, child);
         break;
     case (int) PicoConstants.IOARGS:
         ChildIoargs(node, child);
         break;
     case (int) PicoConstants.END_ARGS:
         ChildEndArgs(node, child);
         break;
     case (int) PicoConstants.ARG12:
         ChildArg12(node, child);
         break;
     case (int) PicoConstants.ARG34:
         ChildArg34(node, child);
         break;
     case (int) PicoConstants.ARG123:
         ChildArg123(node, child);
         break;
     case (int) PicoConstants.ARG1234:
         ChildArg1234(node, child);
         break;
     case (int) PicoConstants.ARG1:
         ChildArg1(node, child);
         break;
     case (int) PicoConstants.ARG2:
         ChildArg2(node, child);
         break;
     case (int) PicoConstants.ARG3:
         ChildArg3(node, child);
         break;
     case (int) PicoConstants.ARG4:
         ChildArg4(node, child);
         break;
     }
 }
 /**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public virtual void ChildNoteTextAttribute(Production node, Node child)
 {
     node.AddChild(child);
 }
Example #27
0
 private string GetTitle(Node node)
 {
     // Join together the value of the token as well as the FreeLine (if present)
     return string.Join(" ", GetChildValues(node).Cast<string>().ToArray());
 }
 /**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public virtual void ChildPlayerNameAttribute(Production node, Node child)
 {
     node.AddChild(child);
 }
Example #29
0
        private static Formule parseNode(Node n)
        {
            if(String.Equals(n.Name, "FORMULE"))
            {

                Node child1 = n.GetChildAt(0);
                List<Formule> list = new List<Formule>();

                if (String.Equals(child1.Name, "NOT"))
                {
                    if (n.GetChildAt(1).GetChildAt(0).Name == "PREDICAT") /* Le not s'applique seulement au predicat qui le suit */
                    {
                        Formule f = parseNode(n.GetChildAt(1));
                        return f.encapsuleNot();
                    }
                    else /* Le not s'applique sur tout le reste de la formule */
                    {
                        list.Add(parseNode(n.GetChildAt(1)));
                        return new Formule(Formule.Formule_Type.neg, "empty", list);
                    }
                }
                else if(String.Equals(child1.Name, "FORALL"))
                {
                    Node varNode = n.GetChildAt(1);
                    list.Add(new Formule(Formule.Formule_Type.variable, ""+formule_str[varNode.StartColumn-1], null));
                    list.Add(parseNode(n.GetChildAt(2)));
                    return new Formule(Formule.Formule_Type.forall, "empty", list);
                }
                else if(String.Equals(child1.Name, "EXISTS"))
                {
                    Node varNode = n.GetChildAt(1);
                    list.Add(new Formule(Formule.Formule_Type.variable, "" + formule_str[varNode.StartColumn-1], null));
                    list.Add(parseNode(n.GetChildAt(2)));
                    return new Formule(Formule.Formule_Type.exists, "empty", list);
                }
                else if(String.Equals(child1.Name, "PREDICAT"))
                {
                    Node pred = child1.GetChildAt(0);
                    Formule formPred = formuleFromPred(pred);

                    if(n.GetChildCount() == 1)
                    {
                        return formPred;
                    }
                    else
                    {
                        Node child2 = n.GetChildAt(1);
                        Node connecteur = child2.GetChildAt(0);
                        Formule.Formule_Type type;
                        if (String.Equals(connecteur.Name, "AND"))
                            type = Formule.Formule_Type.and;
                        else if (String.Equals(connecteur.Name, "OR"))
                            type = Formule.Formule_Type.or;
                        else /* IMPLY */
                            type = Formule.Formule_Type.impl;
                        list.Add(formPred);
                        list.Add(parseNode(child2.GetChildAt(1)));
                        return new Formule(type, "empty", list);
                    }
                }
                else /* equals "(" */
                {
                    Node child3 = n.GetChildAt(2);
                    Node connecteur = child3.GetChildAt(0);

                    if(connecteur.Name == "RIGHT_PAREN")
                    {
                        return parseNode(n.GetChildAt(1));
                    }
                    /* Si connecteur */
                    Formule.Formule_Type type;
                    if (String.Equals(connecteur.Name, "AND"))
                        type = Formule.Formule_Type.and;
                    else if (String.Equals(connecteur.Name, "OR"))
                        type = Formule.Formule_Type.or;
                    else /* IMPLY */
                        type = Formule.Formule_Type.impl;
                    list.Add(parseNode(n.GetChildAt(1)));
                    list.Add(parseNode(child3.GetChildAt(1)));
                    return new Formule(type, "empty", list);
                }
            }
            Console.WriteLine("Erreur cas inconnu FormuleFactory");
            return null;
        }
Example #30
0
 /**
  * <summary>Called when adding a child to a parse tree
  * node.</summary>
  *
  * <param name='node'>the parent node</param>
  * <param name='child'>the child node, or null</param>
  *
  * <exception cref='ParseException'>if the node analysis
  * discovered errors</exception>
  */
 public virtual void ChildInteger(Production node, Node child)
 {
     node.AddChild(child);
 }