java编译器语法分析源码,grammaranalyzer.java 源代码在线查看 - Grammatica是一个C#和Java的语法分析程序生成器(编译器的编译器)。它可以用LL(k)语法创建可读...

这段代码定义了一系列方法,用于处理解析树的不同节点。当进入、退出节点或添加子节点时,这些方法会被调用。每个方法都抛出ParseException如果在分析节点时发现错误,并且大多数方法将节点添加到解析树。
摘要由CSDN通过智能技术生成

/** * Called when entering a parse tree node. * * @param node the node being entered * * @throws ParseException if the node analysis discovered errors */ protected void enterHeaderPart(Production node) throws ParseException { } /** * Called when exiting a parse tree node. * * @param node the node being exited * * @return the node to add to the parse tree * * @throws ParseException if the node analysis discovered errors */ protected Node exitHeaderPart(Production node) throws ParseException { return node; } /** * Called when adding a child to a parse tree node. * * @param node the parent node * @param child the child node, or null * * @throws ParseException if the node analysis discovered errors */ protected void childHeaderPart(Production node, Node child) throws ParseException { node.addChild(child); } /** * Called when entering a parse tree node. * * @param node the node being entered * * @throws ParseException if the node analysis discovered errors */ protected void enterHeaderDeclaration(Production node) throws ParseException { } /** * Called when exiting a parse tree node. * * @param node the node being exited * * @return the node to add to the parse tree * * @throws ParseException if the node analysis discovered errors */ protected Node exitHeaderDeclaration(Production node) throws ParseException { return node; } /** * Called when adding a child to a parse tree node. * * @param node the parent node * @param child the child node, or null * * @throws ParseException if the node analysis discovered errors */ protected void childHeaderDeclaration(Production node, Node child) throws ParseException { node.addChild(child); } /** * Called when entering a parse tree node. * * @param node the node being entered * * @throws ParseException if the node analysis discovered errors */ protected void enterTokenPart(Production node) throws ParseException { } /** * Called when exiting a parse tree node. * * @param node the node being exited * * @return the node to add to the parse tree * * @throws ParseException if the node analysis discovered errors */ protected Node exitTokenPart(Production node) throws ParseException { return node; } /** * Called when adding a child to a parse tree node. * * @param node the parent node * @param child the child node, or null * * @throws ParseException if the node analysis discovered errors */ protected void childTokenPart(Production node, Node child) throws ParseException { node.addChild(child); } /** * Called when entering a parse tree node. * * @param node the node being entered * * @throws ParseException if the node analysis discovered errors */ protected void enterTokenDeclaration(Production node) throws ParseException { } /** * Called when exiting a parse tree node. * * @param node the node being exited * * @return the node to add to the parse tree * * @throws ParseException if the node analysis discovered errors */ protected Node exitTokenDeclaration(Production node) throws ParseException { return node; } /** * Called when adding a child to a parse tree node. * * @param node the parent node * @param child the child node, or null * * @throws ParseException if the node analysis discovered errors */ protected void childTokenDeclaration(Production node, Node child) throws ParseException { node.addChild(child); } /** * Called when entering a parse tree node. * * @param node the node being entered * * @throws ParseException if the node analysis discovered errors */ protected void enterTokenValue(Production node) throws ParseException { } /** * Called when exiting a parse tree node. * * @param node the node being exited * * @return the node to add to the parse tree * * @throws ParseException if the node analysis discovered errors */ protected Node exitTokenValue(Production node) throws ParseException { return node; } /** * Called when adding a child to a parse tree node. * * @param node the parent node * @param child the child node, or null * * @throws ParseException if the node analysis discovered errors */ protected void childTokenValue(Production node, Node child) throws ParseException { node.addChild(child); } /** * Called when entering a parse tree node. * * @param node the node being entered * * @throws ParseException if the node analysis discovered errors */ protected void enterTokenHandling(Production node) throws ParseException { } /** * Called when exiting a parse tree node. * * @param node the node being exited * * @return the node to add to the parse tree * * @throws ParseException if the node analysis discovered errors */ protected Node exitTokenHandling(Production node) throws ParseException { return node; } /** * Called when adding a child to a parse tree node. * * @param node the parent node * @param child the child node, or null * * @throws ParseException if the node analysis discovered errors */ protected void childTokenHandling(Production node, Node child) throws ParseException { node.addChild(child); } /** * Called when entering a parse tree node. * * @param node the node being entered * * @throws ParseException if the node analysis discovered errors */ protected void enterProductionPart(Production node) throws ParseException { } /** * Called when exiting a parse tree node. * * @param node the node being exited * * @return the node to add to the parse tree * * @throws ParseException if the node analysis discovered errors */ protected Node exitProductionPart(Production node) throws ParseException { return node; } /** * Called when adding a child to a parse tree node. * * @param node the parent node * @param child the child node, or null * * @throws ParseException if the node analysis discovered errors */ protected void childProductionPart(Production node, Node child) throws ParseException { node.addChild(child); } /** * Called when entering a parse tree node. * * @param node the node being entered * * @throws ParseException if the node analysis discovered errors */ protected void enterProductionDeclaration(Production node) throws ParseException { } /** * Called when exiting a parse tree node. * * @param node the node being exited * * @return the node to add to the parse tree * * @throws ParseException if the node analysis discovered errors */ protected Node exitProductionDeclaration(Production node) throws ParseException { return node; } /** * Called when adding a child to a parse tree node. * * @param node the parent node * @param child the child node, or null * * @throws ParseException if the node analysis discovered errors */ protected void childProductionDeclaration(Production node, Node child) throws ParseException { node.addChild(child); } /** * Called when entering a parse tree node. * * @param node the node being entered * * @throws ParseException if the node analysis discovered errors */ protected void enterProduction(Production node) throws ParseException { } /** * Called when exiting a parse tree node. * * @param node the node being exited * * @return the node to add to the parse tree * * @throws ParseException if the node analysis discovered errors */ protected Node exitProduction(Production node) throws ParseException { return node; } /** * Called when adding a child to a parse tree node. * * @param node the parent node * @param child the child node, or null * * @throws ParseException if the node analysis discovered errors */ protected void childProduction(Production node, Node child) throws ParseException { node.addChild(child); } /** * Called when entering a parse tree node. * * @param node the node being entered * * @throws ParseException if the node analysis discovered errors */ protected void enterProductionAtom(Production node) throws ParseException { } /** * Called when exiting a parse tree node. * * @param node the node being exited * * @return the node to add to the parse tree * * @throws ParseException if the node analysis discovered errors */ protected Node exitProductionAtom(Production node) throws ParseException { return node; } /** * Called when adding a child to a parse tree node. * * @param node the parent node * @param child the child node, or null * * @throws ParseException if the node analysis discovered errors */ protected void childProductionAtom(Production node, Node child) throws ParseException { node.addChild(child); }}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值