Added a new syntax for verbose embeddings. This adds parentheses:
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Fri, 9 Mar 2007 19:46:32 +0000 (19:46 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Fri, 9 Mar 2007 19:46:32 +0000 (19:46 +0000)
    $from(action_name);

Verbose embeddings without parentheses can make code difficult to read
because they force a space in the middle of an action embedding. There is a
tendency to associtate spaces with concatenation. Without syntax
highlighting to make it clear that the embedding type is a keyword, the
problem is especially bad. The danger is that a verbose embedding could be
read as an embedding of the embedding type:

    main := 'foo' $from some_action '\n';

With parentheses this statment reads much more clearly.

    main := 'foo' $from(some_action) '\n';

git-svn-id: http://svn.complang.org/ragel/trunk@126 052ea7fc-9027-0410-9066-f65837a77df0

ChangeLog
TODO
ragel/rlparse.kl

index c848c8e..7e114f8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+For Next Release
+================
+ -Added a new syntax for verbose embeddings. This adds parentheses: 
+      $from(action_name);
+  Verbose embeddings without parentheses can make code difficult to read
+  because they force a space in the middle of an action embedding. There is a
+  tendency to associtate spaces with concatenation. Without syntax
+  highlighting to make it clear that the embedding type is a keyword, the
+  problem is especially bad. The danger is that a verbose embedding could be
+  read as an embedding of the embedding type:
+      main := 'foo' $from some_action '\n';
+  With parentheses this statment reads much more clearly.
+      main := 'foo' $from(some_action) '\n';
+
 Ragel 5.18 - February 13, 2007
 ==============================
  -There is now a 100% correspondence between state id numbers in the
diff --git a/TODO b/TODO
index c84cb27..14b7eee 100644 (file)
--- a/TODO
+++ b/TODO
@@ -10,7 +10,6 @@ When priorities are embedded without a name, the name of the current machine is
 used. Perhaps a unique name for each instance of the current machine should be
 used instead. This idea could work well if applied to user-defined embeddings. 
 
-Verbose embeddings %eof a  to   $eof(a).
 User defined embeddings <-name(a1,a2,...).
 User defined operators expr1 <name> expr2.
 
index 6fb8cb2..37e5287 100644 (file)
@@ -663,6 +663,7 @@ type action_ref
 nonterm action_embed uses action_ref;
 
 action_embed: action_embed_word final { $$->action = $1->action; };
+action_embed: '(' action_embed_word ')' final { $$->action = $2->action; };
 action_embed: action_embed_block final { $$->action = $1->action; };
 
 nonterm action_embed_word uses action_ref;