Tizen 2.0 Release
[external/ragel.git] / test / langtrans_d.txl
index a9151f9..3d8b8a7 100644 (file)
@@ -95,6 +95,13 @@ function alStmtToD1 AlStmt [action_lang_stmt]
                Result
 end function
 
+function alTermToD
+       replace [al_term]
+               'first_token_char
+       by
+               'ts '[0]
+end function
+
 function alExprExtendToD AlExprExtend [repeat al_expr_extend]
        deconstruct AlExprExtend
                Op [al_expr_op] Term [al_term] Rest [repeat al_expr_extend]
@@ -102,7 +109,7 @@ function alExprExtendToD AlExprExtend [repeat al_expr_extend]
                _ [alExprExtendToD Rest]
        replace [repeat d_expr_extend]
        by
-               Op Term DRest
+               Op Term [alTermToD] DRest
 end function
 
 function alExprToD AlExpr [al_expr]
@@ -111,7 +118,7 @@ function alExprToD AlExpr [al_expr]
        construct DExprExtend [repeat d_expr_extend]
                _ [alExprExtendToD AlExprExtend]
        construct Result [opt d_expr]
-               ALTerm DExprExtend
+               ALTerm [alTermToD] DExprExtend
        replace [opt d_expr]
        by
                Result
@@ -174,7 +181,7 @@ function alStmtToD4a AlStmt [action_lang_stmt]
                'printi Id [id] ';
        replace [repeat d_lang_stmt]
        by
-               'writef '( '"%d" ', Id ');
+               'writef '( '"%d" ', Id ') ';
 end function
 
 function alStmtToD4b AlStmt [action_lang_stmt]
@@ -182,7 +189,25 @@ function alStmtToD4b AlStmt [action_lang_stmt]
                'prints String [stringlit] ';
        replace [repeat d_lang_stmt]
        by
-               'writef '( '"%s" ', String ');
+               'writef '( '"%s" ', String ') ';
+end function
+
+function alStmtToD4c AlStmt [action_lang_stmt]
+       deconstruct AlStmt
+               'printb Id [id] ';
+       replace [repeat d_lang_stmt]
+       by
+               '_s '= Id '[0..pos] ';
+               'writef '( '"%s" ', '_s ') ';
+end function
+
+function alStmtToD4d AlStmt [action_lang_stmt]
+       deconstruct AlStmt
+               'print_token ';
+       replace [repeat d_lang_stmt]
+       by
+               '_s '= ts '[0..(te-ts)] ';
+               'writef '( '"%s" ', '_s ') ';
 end function
 
 function alStmtToD5 AlStmt [action_lang_stmt]
@@ -213,6 +238,8 @@ function alToD AlStmts [repeat action_lang_stmt]
                        [alStmtToD3 FirstStmt]
                        [alStmtToD4a FirstStmt]
                        [alStmtToD4b FirstStmt]
+                       [alStmtToD4c FirstStmt]
+                       [alStmtToD4d FirstStmt]
                        [alStmtToD5 FirstStmt]
                        [alStmtToD6 FirstStmt]
        construct DRest [repeat d_lang_stmt]