瀏覽代碼

Added some test files

develop-theo
Theo Souchon 2 年之前
父節點
當前提交
621a7863cb
共有 5 個檔案被更改,包括 66 行新增0 行删除
  1. +14
    -0
      tests-parsimony/001.c
  2. +5
    -0
      tests-parsimony/002.c
  3. +1
    -0
      tests-parsimony/003.c
  4. +9
    -0
      tests-parsimony/004.c
  5. +37
    -0
      tests-parsimony/tmp.c

+ 14
- 0
tests-parsimony/001.c 查看文件

@ -0,0 +1,14 @@
@{ newObject(type, fields) { fields.__proto__ = type; fields }
newCint(text) { newObject(C_int, { text: text }) }
newCstring(text) { newObject(C_string, { text: "\""+text+"\"" }) }
newCinitializer(list) { { __proto__: C_initializer, leftCurly: lcurly, initList: list, rightCurly: rcurly } }
newToken(text) { { __proto__: Token, text: text } }
comma = newToken(",");
lcurly = newToken("{");
rcurly = newToken("}");
}
enum foo { FOO, BAR, BAZ };
char *x[] = @(newCinitializer([newCstring("X"), comma, newCstring("Y")]));
int i = @(newCint("42"));
char *foos[] = { "FOO", "BAR", "BAZ" };

+ 5
- 0
tests-parsimony/002.c 查看文件

@ -0,0 +1,5 @@
@(a = `constant 10)
int q = @(`constant 10);
int w = @(a);

+ 1
- 0
tests-parsimony/003.c 查看文件

@ -0,0 +1 @@
int i = @({ __proto__: Token, text: "14" });

+ 9
- 0
tests-parsimony/004.c 查看文件

@ -0,0 +1,9 @@
@{if (1) print("yo");}
int main(){
if (1) {
return 0;
} else {
return 1;
}
}

+ 37
- 0
tests-parsimony/tmp.c 查看文件

@ -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"));

Loading…
取消
儲存