summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Ageev <antage@gmail.com>2012-09-07 18:27:43 +0400
committerAnton Ageev <antage@gmail.com>2012-09-07 18:27:43 +0400
commit6af1e5f98d347a149a4745408c88bdb28a951c9a (patch)
tree5085882348d461483dddd26c1139f2780d62d7a9
parent34bb5e97eed99eeca6552f7835c84e264903c4eb (diff)
downloadragel-6af1e5f98d347a149a4745408c88bdb28a951c9a.tar.gz
Added explicit type casting in tests (it needs for languages that has no implicit type conversion)
-rw-r--r--test/atoi1.rl2
-rw-r--r--test/atoi2.rl2
-rw-r--r--test/cond7.rl4
-rw-r--r--test/cppscan6.rl2
-rw-r--r--test/langtrans_c.txl18
-rw-r--r--test/langtrans_csharp.txl18
-rw-r--r--test/langtrans_d.txl18
-rw-r--r--test/langtrans_java.txl18
-rw-r--r--test/langtrans_ruby.txl18
-rw-r--r--test/testcase.txl1
10 files changed, 91 insertions, 10 deletions
diff --git a/test/atoi1.rl b/test/atoi1.rl
index ea706c8c..013348e0 100644
--- a/test/atoi1.rl
+++ b/test/atoi1.rl
@@ -19,7 +19,7 @@ neg = false;
}
action add_digit {
- val = val * 10 + (fc - 48);
+ val = val * 10 + <int>(fc - 48);
}
action finish {
diff --git a/test/atoi2.rl b/test/atoi2.rl
index 923e88f0..9f17c69a 100644
--- a/test/atoi2.rl
+++ b/test/atoi2.rl
@@ -20,7 +20,7 @@ neg = false;
}
action add_digit {
- val = val * 10 + (fc - 48);
+ val = val * 10 + <int>(fc - 48);
}
action finish {
diff --git a/test/cond7.rl b/test/cond7.rl
index 3951af0f..a88e67c5 100644
--- a/test/cond7.rl
+++ b/test/cond7.rl
@@ -11,14 +11,14 @@ int c;
action testi {i > 0}
action inc {
i = i - 1;
- c = fc;
+ c = <int>(fc);
prints "item: ";
printi c;
prints "\n";
}
count = [0-9] @{
- i = fc - '0';
+ i = <int>(fc - '0');
prints "count: ";
printi i;
prints "\n";
diff --git a/test/cppscan6.rl b/test/cppscan6.rl
index ed82fe6c..ad2d2663 100644
--- a/test/cppscan6.rl
+++ b/test/cppscan6.rl
@@ -266,7 +266,7 @@ int token;
# Single char symbols.
( punct - [_"'] ) => {
- token = first_token_char;
+ token = <int>(first_token_char);
prints "<";
printi token;
prints "> ";
diff --git a/test/langtrans_c.txl b/test/langtrans_c.txl
index e80e5080..5a4971ff 100644
--- a/test/langtrans_c.txl
+++ b/test/langtrans_c.txl
@@ -122,11 +122,27 @@ function alStmtToC1 AlStmt [action_lang_stmt]
Result
end function
-function alTermToC
+rule alTermToC1
replace [al_term]
'first_token_char
by
'ts '[0]
+end rule
+
+rule alTermToC2
+ replace [al_term]
+ '< _ [al_type_decl] '> '( AlExpr [al_expr] ')
+ by
+ '( AlExpr ')
+end rule
+
+function alTermToC
+ replace [al_term]
+ AlTerm [al_term]
+ by
+ AlTerm
+ [alTermToC1]
+ [alTermToC2]
end function
function alExprExtendToC AlExprExtend [repeat al_expr_extend]
diff --git a/test/langtrans_csharp.txl b/test/langtrans_csharp.txl
index cf4a2c10..a8c60038 100644
--- a/test/langtrans_csharp.txl
+++ b/test/langtrans_csharp.txl
@@ -125,11 +125,27 @@ function alStmtToCSharp1 AlStmt [action_lang_stmt]
Result
end function
-function alTermToCSharp
+rule alTermToCSharp1
replace [al_term]
'first_token_char
by
'data '[ts]
+end rule
+
+rule alTermToCSharp2
+ replace [al_term]
+ '< _ [al_type_decl] '> '( AlExpr [al_expr] ')
+ by
+ '( AlExpr ')
+end rule
+
+function alTermToCSharp
+ replace [al_term]
+ AlTerm [al_term]
+ by
+ AlTerm
+ [alTermToCSharp1]
+ [alTermToCSharp2]
end function
function alExprExtendToCSharp AlExprExtend [repeat al_expr_extend]
diff --git a/test/langtrans_d.txl b/test/langtrans_d.txl
index 3d8b8a7c..845a0034 100644
--- a/test/langtrans_d.txl
+++ b/test/langtrans_d.txl
@@ -95,11 +95,27 @@ function alStmtToD1 AlStmt [action_lang_stmt]
Result
end function
-function alTermToD
+rule alTermToD1
replace [al_term]
'first_token_char
by
'ts '[0]
+end rule
+
+rule alTermToD2
+ replace [al_term]
+ '< _ [al_type_decl] '> '( AlExpr [al_expr] ')
+ by
+ '( AlExpr ')
+end rule
+
+function alTermToD
+ replace [al_term]
+ AlTerm [al_term]
+ by
+ AlTerm
+ [alTermToD1]
+ [alTermToD2]
end function
function alExprExtendToD AlExprExtend [repeat al_expr_extend]
diff --git a/test/langtrans_java.txl b/test/langtrans_java.txl
index 8016ab24..c5cde5d8 100644
--- a/test/langtrans_java.txl
+++ b/test/langtrans_java.txl
@@ -132,11 +132,27 @@ function alStmtToJava1 AlStmt [action_lang_stmt]
Result
end function
-function alTermToJava
+rule alTermToJava1
replace [al_term]
'first_token_char
by
'data '[ts]
+end rule
+
+rule alTermToJava2
+ replace [al_term]
+ '< _ [al_type_decl] '> '( AlExpr [al_expr] ')
+ by
+ '( AlExpr ')
+end rule
+
+function alTermToJava
+ replace [al_term]
+ AlTerm [al_term]
+ by
+ AlTerm
+ [alTermToJava1]
+ [alTermToJava2]
end function
function alExprExtendToJava AlExprExtend [repeat al_expr_extend]
diff --git a/test/langtrans_ruby.txl b/test/langtrans_ruby.txl
index 265426f4..42f203de 100644
--- a/test/langtrans_ruby.txl
+++ b/test/langtrans_ruby.txl
@@ -140,11 +140,27 @@ function alStmtToRuby1 AlStmt [action_lang_stmt]
[initDecl5 VarDecl]
end function
-function alTermToRuby
+rule alTermToRuby1
replace [al_term]
'first_token_char
by
'data '[ts]
+end rule
+
+rule alTermToRuby2
+ replace [al_term]
+ '< _ [al_type_decl] '> '( AlExpr [al_expr] ')
+ by
+ '( AlExpr ')
+end rule
+
+function alTermToRuby
+ replace [al_term]
+ AlTerm [al_term]
+ by
+ AlTerm
+ [alTermToRuby1]
+ [alTermToRuby2]
end function
function alExprExtendToRuby AlExprExtend [repeat al_expr_extend]
diff --git a/test/testcase.txl b/test/testcase.txl
index 3369c15f..65d7912c 100644
--- a/test/testcase.txl
+++ b/test/testcase.txl
@@ -127,6 +127,7 @@ define al_term_base
| 'true
| 'false
| '( [al_expr] ')
+ | '< [SPOFF] [al_type_decl] '> '( [SPON] [al_expr] ')
| 'first_token_char
end define