|
|
@ -0,0 +1,37 @@ |
|
|
|
@{ |
|
|
|
|
|
|
|
// File used only for rule creation help |
|
|
|
|
|
|
|
newObject(type, fields) { fields.__proto__ = type; fields } |
|
|
|
newCint(text) { newObject(C_int, { text: text }) } |
|
|
|
newCstring(text) { newObject(C_string, { text: "\""+text+"\"" }) } |
|
|
|
newCinitializer(list) { newObject(C_initializer, { leftCurly: lcurly, initList: list, rightCurly: rcurly }) } |
|
|
|
//newCif(list) { newObject(C_if, {ifTok: iftok, lParen: lpar, condition: , oop rParen, oop consequent }) } |
|
|
|
|
|
|
|
newCexpression() {} |
|
|
|
|
|
|
|
//newCcondition() { newObject(C_conditional, {logicalOrExpression, question, expression, colon, conditionalExpression}) } |
|
|
|
|
|
|
|
//newCbinary() { newObject() } |
|
|
|
|
|
|
|
//newCcast() { newObject(C_cast, { lParen: lpar, typeName, rParen: rpar, expression }) } |
|
|
|
|
|
|
|
//newCdeclaration() { newObject(C_declaration, {specifiers, declarators, semicolon: semicolon }) } |
|
|
|
|
|
|
|
newCstatement() {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
newToken(text) { { __proto__: Token, text: text } } |
|
|
|
comma = newToken(","); |
|
|
|
semicolon = newToken(";"); |
|
|
|
lcurly = newToken("{"); |
|
|
|
rcurly = newToken("}"); |
|
|
|
lpar = newToken("("); |
|
|
|
rpar = newToken(")"); |
|
|
|
iftok = newToken("if"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
char *x[] = @(newCinitializer([newCstring("X"), comma, newCstring("Y")])); |
|
|
|
int i = @(newCint("42")); |