Пример #1
0
 /**
  * Handles the parser adding a child node to a production. This
  * method calls the appropriate analyzer callback. Note that this
  * method will not call any callback if an error requiring
  * recovery has ocurred.
  *
  * @param node           the parent parse tree node
  * @param child          the child parse tree node, or null
  */
 internal void AddNode(Production node, Node child)
 {
     if (errorRecovery >= 0)
     {
         // Do nothing
     }
     else if (node.IsHidden())
     {
         node.AddChild(child);
     }
     else if (child != null && child.IsHidden())
     {
         for (int i = 0; i < child.Count; i++)
         {
             AddNode(node, child[i]);
         }
     }
     else
     {
         try {
             analyzer.Child(node, child);
         } catch (ParseException e) {
             AddError(e, false);
         }
     }
 }
Пример #2
0
 /**
  * Handles the parser entering a production. This method calls the
  * appropriate analyzer callback if the node is not hidden. Note
  * that this method will not call any callback if an error
  * requiring recovery has ocurred.
  *
  * @param node           the parse tree node
  */
 internal void EnterNode(Node node)
 {
     if (!node.IsHidden() && errorRecovery < 0)
     {
         try {
             analyzer.Enter(node);
         } catch (ParseException e) {
             AddError(e, false);
         }
     }
 }
Пример #3
0
 /**
  * Handles the parser leaving a production. This method calls the
  * appropriate analyzer callback if the node is not hidden, and
  * returns the result. Note that this method will not call any
  * callback if an error requiring recovery has ocurred.
  *
  * @param node           the parse tree node
  *
  * @return the parse tree node, or
  *         null if no parse tree should be created
  */
 internal Node ExitNode(Node node)
 {
     if (!node.IsHidden() && errorRecovery < 0)
     {
         try {
             return(analyzer.Exit(node));
         } catch (ParseException e) {
             AddError(e, false);
         }
     }
     return(node);
 }
Пример #4
0
 /**
  * Handles the parser adding a child node to a production. This
  * method calls the appropriate analyzer callback. Note that this
  * method will not call any callback if an error requiring
  * recovery has ocurred.
  *
  * @param node           the parent parse tree node
  * @param child          the child parse tree node, or null
  */
 internal void AddNode(Production node, Node child) {
     if (errorRecovery >= 0) {
         // Do nothing
     } else if (node.IsHidden()) {
         node.AddChild(child);
     } else if (child != null && child.IsHidden()) {
         for (int i = 0; i < child.Count; i++) {
             AddNode(node, child[i]);
         }
     } else {
         try {
             analyzer.Child(node, child);
         } catch (ParseException e) {
             AddError(e, false);
         }
     }
 }
Пример #5
0
 /**
  * Handles the parser leaving a production. This method calls the
  * appropriate analyzer callback if the node is not hidden, and
  * returns the result. Note that this method will not call any
  * callback if an error requiring recovery has ocurred.
  *
  * @param node           the parse tree node
  *
  * @return the parse tree node, or
  *         null if no parse tree should be created
  */
 internal Node ExitNode(Node node) {
     if (!node.IsHidden() && errorRecovery < 0) {
         try {
             return analyzer.Exit(node);
         } catch (ParseException e) {
             AddError(e, false);
         }
     }
     return node;
 }
Пример #6
0
 /**
  * Handles the parser entering a production. This method calls the
  * appropriate analyzer callback if the node is not hidden. Note
  * that this method will not call any callback if an error
  * requiring recovery has ocurred.
  *
  * @param node           the parse tree node
  */
 internal void EnterNode(Node node) {
     if (!node.IsHidden() && errorRecovery < 0) {
         try {
             analyzer.Enter(node);
         } catch (ParseException e) {
             AddError(e, false);
         }
     }
 }