textmapper icon indicating copy to clipboard operation
textmapper copied to clipboard

Node as nonterminal name

Open jonyrock opened this issue 12 years ago • 1 comments

Lets consider a .tm file

language prop(java);

prefix = "AST"
package = "ru.aptu.xml"
gentree=true
genast=true
positions="offset, line"
endpositions="offset"

:: lexer

identifier(String): /[a-zA-Z_][a-zA-Z_0-9]*/   { $symbol = current(); }
openChar:       /</
closeChar:      />/
_skip:          /[\n\t\r ]+/ (space)

:: parser

input ::= root=node;
node ::= openChar identifier closeChar;

This compiles successfully without any warning but leads to a semantically wrong program. In /ast/AstNode we will get

public class AstNode extends AstNode {
}

jonyrock avatar Sep 11 '13 15:09 jonyrock

It looks as though this issue has been resolved.

Given the grammar a.tm, the output is ast/Ast_Node.java:

public class Ast_Node extends AstNode {

As such. Feel free to close this issue.

mewmew avatar Nov 03 '18 20:11 mewmew