Revision: 19434
          http://sourceforge.net/p/gate/code/19434
Author:   ian_roberts
Date:     2016-06-22 11:56:23 +0000 (Wed, 22 Jun 2016)
Log Message:
-----------
Allow quoted strings for annotation types and feature names in JAPE LHS 
constraints and RHS actions (and in the Input line).  This allows JAPE rules to 
match (and create) annotation types and features that are not valid Java 
identifiers, e.g.

Phase: Sample
Input: a "w:p"
Options: control = appelt

Rule: ExampleRule
({a."data-role" == "popup"}):link
-->
:link."New annotation" = {"feature 1" = "value 2"}

Rule: WordML
({"w:p"}):paragraph
-->
:paragraph.foo = {}

Note that phase names, rule names, binding labels (:link), macro names, 
template names and template parameters are still restricted to Java identifiers.

Modified Paths:
--------------
    gate/trunk/src/main/gate/jape/parser/ParseCpsl.java
    gate/trunk/src/main/gate/jape/parser/ParseCpsl.jj
    gate/trunk/src/main/gate/jape/parser/ParseCpslPlain.html

Modified: gate/trunk/src/main/gate/jape/parser/ParseCpsl.java
===================================================================
--- gate/trunk/src/main/gate/jape/parser/ParseCpsl.java 2016-06-22 01:23:02 UTC 
(rev 19433)
+++ gate/trunk/src/main/gate/jape/parser/ParseCpsl.java 2016-06-22 11:56:23 UTC 
(rev 19434)
@@ -132,6 +132,19 @@
   }
 
   /**
+   * Normalise for quoted and unquoted strings - if the token is a string,
+   * strip the quotes off its image, otherwise return the image as-is.
+   */
+  protected String stringValueOf(Token tok) {
+    if(tok.kind == string) {
+      // quoted string - strip the quotes
+      return tok.image.substring(1, tok.image.length() - 1);
+    } else {
+      return tok.image;
+    }
+  }
+
+  /**
    * Append the given string to the end of the given buffer as a Java string
    * literal.  If <code>str</code> is <code>null</code>, we append the four
    * characters n, u, l, l.  Otherwise, we append the contents of str 
surrounded
@@ -551,6 +564,7 @@
         label_5:
         while (true) {
           switch (jj_nt.kind) {
+          case string:
           case ident:{
             ;
             break;
@@ -559,8 +573,21 @@
             jj_la1[7] = jj_gen;
             break label_5;
           }
-          inputTok = jj_consume_token(ident);
-t.addInput(inputTok.image);
+          switch (jj_nt.kind) {
+          case ident:{
+            inputTok = jj_consume_token(ident);
+            break;
+            }
+          case string:{
+            inputTok = jj_consume_token(string);
+            break;
+            }
+          default:
+            jj_la1[8] = jj_gen;
+            jj_consume_token(-1);
+            throw new ParseException();
+          }
+t.addInput(stringValueOf(inputTok));
         }
         break;
         }
@@ -574,7 +601,7 @@
             break;
             }
           default:
-            jj_la1[8] = jj_gen;
+            jj_la1[9] = jj_gen;
             break label_6;
           }
           optionNameTok = jj_consume_token(ident);
@@ -589,7 +616,7 @@
             break;
             }
           default:
-            jj_la1[9] = jj_gen;
+            jj_la1[10] = jj_gen;
             jj_consume_token(-1);
             throw new ParseException();
           }
@@ -638,7 +665,7 @@
         break;
         }
       default:
-        jj_la1[10] = jj_gen;
+        jj_la1[11] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
@@ -653,7 +680,7 @@
         break;
         }
       default:
-        jj_la1[11] = jj_gen;
+        jj_la1[12] = jj_gen;
         break label_7;
       }
       switch (jj_nt.kind) {
@@ -671,7 +698,7 @@
         break;
         }
       default:
-        jj_la1[12] = jj_gen;
+        jj_la1[13] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
@@ -702,7 +729,7 @@
       break;
       }
     default:
-      jj_la1[13] = jj_gen;
+      jj_la1[14] = jj_gen;
       ;
     }
 if(importblock != null) {
@@ -763,7 +790,7 @@
       break;
       }
     default:
-      jj_la1[14] = jj_gen;
+      jj_la1[15] = jj_gen;
       ;
     }
     lhs = LeftHandSide();
@@ -819,7 +846,7 @@
         break;
         }
       default:
-        jj_la1[15] = jj_gen;
+        jj_la1[16] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
@@ -884,7 +911,7 @@
         break;
         }
       default:
-        jj_la1[16] = jj_gen;
+        jj_la1[17] = jj_gen;
         break label_8;
       }
     }
@@ -896,7 +923,7 @@
         break;
         }
       default:
-        jj_la1[17] = jj_gen;
+        jj_la1[18] = jj_gen;
         break label_9;
       }
       jj_consume_token(bar);
@@ -914,7 +941,7 @@
           break;
           }
         default:
-          jj_la1[18] = jj_gen;
+          jj_la1[19] = jj_gen;
           break label_10;
         }
       }
@@ -962,7 +989,7 @@
       break;
       }
     default:
-      jj_la1[19] = jj_gen;
+      jj_la1[20] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
@@ -989,7 +1016,7 @@
           break;
           }
         default:
-          jj_la1[20] = jj_gen;
+          jj_la1[21] = jj_gen;
           break label_11;
         }
         jj_consume_token(comma);
@@ -1008,7 +1035,7 @@
       break;
       }
     default:
-      jj_la1[21] = jj_gen;
+      jj_la1[22] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
@@ -1033,7 +1060,7 @@
       break;
       }
     default:
-      jj_la1[22] = jj_gen;
+      jj_la1[23] = jj_gen;
       ;
     }
     switch (jj_nt.kind) {
@@ -1049,14 +1076,14 @@
         break;
         }
       default:
-        jj_la1[23] = jj_gen;
+        jj_la1[24] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
       break;
       }
     default:
-      jj_la1[24] = jj_gen;
+      jj_la1[25] = jj_gen;
       ;
     }
 String bindingName = null;
@@ -1100,7 +1127,7 @@
         break;
         }
       default:
-        jj_la1[25] = jj_gen;
+        jj_la1[26] = jj_gen;
         ;
       }
       jj_consume_token(rightSquare);
@@ -1114,7 +1141,7 @@
       break;
       }
     default:
-      jj_la1[26] = jj_gen;
+      jj_la1[27] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
@@ -1139,12 +1166,24 @@
       break;
       }
     default:
-      jj_la1[27] = jj_gen;
+      jj_la1[28] = jj_gen;
       ;
     }
-    // the annotation type
+    switch (jj_nt.kind) {
+    case ident:{
       annotTypeTok = jj_consume_token(ident);
-c = Factory.getConstraintFactory().createConstraint(annotTypeTok.image);
+      break;
+      }
+    case string:{
+      annotTypeTok = jj_consume_token(string);
+      break;
+      }
+    default:
+      jj_la1[29] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+c = 
Factory.getConstraintFactory().createConstraint(stringValueOf(annotTypeTok));
     if(negate) c.negate();
     switch (jj_nt.kind) {
     case metaPropOp:
@@ -1180,12 +1219,13 @@
           break;
           }
         case pling:
+        case string:
         case ident:{
           embeddedConstraint = Constraint();
           break;
           }
         default:
-          jj_la1[28] = jj_gen;
+          jj_la1[30] = jj_gen;
           jj_consume_token(-1);
           throw new ParseException();
         }
@@ -1195,14 +1235,14 @@
         break;
         }
       default:
-        jj_la1[29] = jj_gen;
+        jj_la1[31] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
       break;
       }
     default:
-      jj_la1[30] = jj_gen;
+      jj_la1[32] = jj_gen;
       ;
     }
 {if ("" != null) return c;}
@@ -1216,8 +1256,21 @@
   final public AnnotationAccessor FeatureAccessor() throws ParseException 
{Token attrNameTok = null;
 AnnotationAccessor accessor = null;
     jj_consume_token(period);
-    attrNameTok = jj_consume_token(ident);
-accessor = 
Factory.getConstraintFactory().createDefaultAccessor(attrNameTok.image);
+    switch (jj_nt.kind) {
+    case ident:{
+      attrNameTok = jj_consume_token(ident);
+      break;
+      }
+    case string:{
+      attrNameTok = jj_consume_token(string);
+      break;
+      }
+    default:
+      jj_la1[33] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+accessor = 
Factory.getConstraintFactory().createDefaultAccessor(stringValueOf(attrNameTok));
     {if ("" != null) return accessor;}
     throw new Error("Missing return statement in function");
   }
@@ -1254,7 +1307,7 @@
         break;
         }
       default:
-        jj_la1[31] = jj_gen;
+        jj_la1[34] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
@@ -1309,7 +1362,7 @@
       break;
       }
     default:
-      jj_la1[32] = jj_gen;
+      jj_la1[35] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
@@ -1330,7 +1383,7 @@
         break;
         }
       default:
-        jj_la1[33] = jj_gen;
+        jj_la1[36] = jj_gen;
         break label_12;
       }
       attrNameTok = jj_consume_token(ident);
@@ -1343,7 +1396,7 @@
         break;
         }
       default:
-        jj_la1[34] = jj_gen;
+        jj_la1[37] = jj_gen;
         ;
       }
     }
@@ -1364,7 +1417,7 @@
         break;
         }
       default:
-        jj_la1[35] = jj_gen;
+        jj_la1[38] = jj_gen;
         break label_13;
       }
       jj_consume_token(comma);
@@ -1432,7 +1485,7 @@
         break;
         }
       default:
-        jj_la1[36] = jj_gen;
+        jj_la1[39] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
@@ -1514,7 +1567,7 @@
       break;
       }
     default:
-      jj_la1[37] = jj_gen;
+      jj_la1[40] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
@@ -1530,8 +1583,21 @@
 
     annotSetName = block[0] + "Annots";
     jj_consume_token(period);
-    nameTok = jj_consume_token(ident);
-newAnnotType = nameTok.image;
+    switch (jj_nt.kind) {
+    case ident:{
+      nameTok = jj_consume_token(ident);
+      break;
+      }
+    case string:{
+      nameTok = jj_consume_token(string);
+      break;
+      }
+    default:
+      jj_la1[41] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+newAnnotType = stringValueOf(nameTok);
 
     // start of the attribute stuff
     blockBuffer.append("      java.lang.Object val = null;" + nl);
@@ -1540,18 +1606,31 @@
     label_14:
     while (true) {
       switch (jj_nt.kind) {
+      case string:
       case ident:{
         ;
         break;
         }
       default:
-        jj_la1[38] = jj_gen;
+        jj_la1[42] = jj_gen;
         break label_14;
       }
-      // the name of the attribute, and equals sign
-          nameTok = jj_consume_token(ident);
+      switch (jj_nt.kind) {
+      case ident:{
+        nameTok = jj_consume_token(ident);
+        break;
+        }
+      case string:{
+        nameTok = jj_consume_token(string);
+        break;
+        }
+      default:
+        jj_la1[43] = jj_gen;
+        jj_consume_token(-1);
+        throw new ParseException();
+      }
       jj_consume_token(assign);
-newAttrName = nameTok.image;
+newAttrName = stringValueOf(nameTok);
       switch (jj_nt.kind) {
       case integer:
       case string:
@@ -1630,9 +1709,22 @@
         switch (jj_nt.kind) {
         case period:{
           jj_consume_token(period);
-          nameTok = jj_consume_token(ident);
-existingAnnotType = nameTok.image;
           switch (jj_nt.kind) {
+          case ident:{
+            nameTok = jj_consume_token(ident);
+            break;
+            }
+          case string:{
+            nameTok = jj_consume_token(string);
+            break;
+            }
+          default:
+            jj_la1[44] = jj_gen;
+            jj_consume_token(-1);
+            throw new ParseException();
+          }
+existingAnnotType = stringValueOf(nameTok);
+          switch (jj_nt.kind) {
           case period:{
             opTok = jj_consume_token(period);
             break;
@@ -1642,12 +1734,25 @@
             break;
             }
           default:
-            jj_la1[39] = jj_gen;
+            jj_la1[45] = jj_gen;
             jj_consume_token(-1);
             throw new ParseException();
           }
-          nameTok = jj_consume_token(ident);
-opName = opTok.image; existingAttrName = nameTok.image;
+          switch (jj_nt.kind) {
+          case ident:{
+            nameTok = jj_consume_token(ident);
+            break;
+            }
+          case string:{
+            nameTok = jj_consume_token(string);
+            break;
+            }
+          default:
+            jj_la1[46] = jj_gen;
+            jj_consume_token(-1);
+            throw new ParseException();
+          }
+opName = opTok.image; existingAttrName = stringValueOf(nameTok);
 blockBuffer.append(
     "        if (" + existingAnnotSetName + " != null) {" + nl +
     "          gate.AnnotationSet existingAnnots = " + nl +
@@ -1730,7 +1835,7 @@
           break;
           }
         default:
-          jj_la1[40] = jj_gen;
+          jj_la1[47] = jj_gen;
           jj_consume_token(-1);
           throw new ParseException();
         }
@@ -1740,7 +1845,7 @@
         break;
         }
       default:
-        jj_la1[41] = jj_gen;
+        jj_la1[48] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
@@ -1750,7 +1855,7 @@
         break;
         }
       default:
-        jj_la1[42] = jj_gen;
+        jj_la1[49] = jj_gen;
         ;
       }
     }
@@ -1855,118 +1960,122 @@
     finally { jj_save(1, xla); }
   }
 
-  private boolean jj_3R_17()
+  private boolean jj_3R_27()
  {
-    if (jj_scan_token(ident)) return true;
+    if (jj_scan_token(pling)) return true;
     return false;
   }
 
-  private boolean jj_3R_22()
+  private boolean jj_3R_26()
  {
-    if (jj_scan_token(leftBrace)) return true;
-    if (jj_3R_25()) return true;
+    if (jj_3R_15()) return true;
     return false;
   }
 
-  private boolean jj_3R_15()
+  private boolean jj_3R_25()
  {
     Token xsp;
     xsp = jj_scanpos;
-    if (jj_3R_17()) {
+    if (jj_3R_27()) jj_scanpos = xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(49)) {
     jj_scanpos = xsp;
-    if (jj_3R_18()) {
-    jj_scanpos = xsp;
-    if (jj_3R_19()) return true;
+    if (jj_scan_token(47)) return true;
     }
-    }
     return false;
   }
 
-  private boolean jj_3_2()
+  private boolean jj_3R_23()
  {
-    if (jj_3R_16()) return true;
+    if (jj_scan_token(string)) return true;
     return false;
   }
 
-  private boolean jj_3R_20()
+  private boolean jj_3R_21()
  {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_22()) {
-    jj_scanpos = xsp;
-    if (jj_3R_23()) return true;
-    }
+    if (jj_scan_token(leftBracket)) return true;
+    if (jj_3R_24()) return true;
     return false;
   }
 
-  private boolean jj_3_1()
+  private boolean jj_3R_24()
  {
-    if (jj_3R_15()) return true;
+    Token xsp;
+    if (jj_3R_26()) return true;
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_26()) { jj_scanpos = xsp; break; }
+    }
     return false;
   }
 
-  private boolean jj_3R_27()
+  private boolean jj_3R_19()
  {
-    if (jj_scan_token(pling)) return true;
+    if (jj_3R_21()) return true;
     return false;
   }
 
-  private boolean jj_3R_26()
+  private boolean jj_3R_18()
  {
-    if (jj_3R_15()) return true;
+    if (jj_3R_20()) return true;
     return false;
   }
 
-  private boolean jj_3R_25()
+  private boolean jj_3R_16()
  {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_27()) jj_scanpos = xsp;
+    if (jj_scan_token(colon)) return true;
     if (jj_scan_token(ident)) return true;
+    if (jj_scan_token(leftBrace)) return true;
     return false;
   }
 
-  private boolean jj_3R_23()
+  private boolean jj_3R_17()
  {
-    if (jj_scan_token(string)) return true;
+    if (jj_scan_token(ident)) return true;
     return false;
   }
 
-  private boolean jj_3R_21()
+  private boolean jj_3R_22()
  {
-    if (jj_scan_token(leftBracket)) return true;
-    if (jj_3R_24()) return true;
+    if (jj_scan_token(leftBrace)) return true;
+    if (jj_3R_25()) return true;
     return false;
   }
 
-  private boolean jj_3R_24()
+  private boolean jj_3R_15()
  {
     Token xsp;
-    if (jj_3R_26()) return true;
-    while (true) {
-      xsp = jj_scanpos;
-      if (jj_3R_26()) { jj_scanpos = xsp; break; }
+    xsp = jj_scanpos;
+    if (jj_3R_17()) {
+    jj_scanpos = xsp;
+    if (jj_3R_18()) {
+    jj_scanpos = xsp;
+    if (jj_3R_19()) return true;
     }
+    }
     return false;
   }
 
-  private boolean jj_3R_19()
+  private boolean jj_3_2()
  {
-    if (jj_3R_21()) return true;
+    if (jj_3R_16()) return true;
     return false;
   }
 
-  private boolean jj_3R_16()
+  private boolean jj_3R_20()
  {
-    if (jj_scan_token(colon)) return true;
-    if (jj_scan_token(ident)) return true;
-    if (jj_scan_token(leftBrace)) return true;
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_22()) {
+    jj_scanpos = xsp;
+    if (jj_3R_23()) return true;
+    }
     return false;
   }
 
-  private boolean jj_3R_18()
+  private boolean jj_3_1()
  {
-    if (jj_3R_20()) return true;
+    if (jj_3R_15()) return true;
     return false;
   }
 
@@ -1980,7 +2089,7 @@
   private Token jj_scanpos, jj_lastpos;
   private int jj_la;
   private int jj_gen;
-  final private int[] jj_la1 = new int[43];
+  final private int[] jj_la1 = new int[50];
   static private int[] jj_la1_0;
   static private int[] jj_la1_1;
   static private int[] jj_la1_2;
@@ -1990,13 +2099,13 @@
       jj_la1_init_2();
    }
    private static void jj_la1_init_0() {
-      jj_la1_0 = new int[] 
{0x800,0xe00000,0xe00000,0x1000000,0x2000,0x1f01000,0x6000000,0x0,0x0,0x0,0x6000000,0x38000000,0x38000000,0x100000,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
+      jj_la1_0 = new int[] 
{0x800,0xe00000,0xe00000,0x1000000,0x2000,0x1f01000,0x6000000,0x0,0x0,0x0,0x0,0x6000000,0x38000000,0x38000000,0x100000,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x0,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
    }
    private static void jj_la1_init_1() {
-      jj_la1_1 = new int[] 
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x20000,0x20000,0x30000,0x0,0x0,0x0,0x0,0x0,0x2120000,0xa028000,0x800000,0xa028000,0xa028000,0x1000000,0x2008000,0x20000001,0x20008,0x100000,0x1000000,0x20000001,0x0,0x2020000,0x420004,0x420004,0x78008,0x20078008,0x20000,0x1000000,0x1000000,0x2120000,0x100000,0x20000,0x400004,0x400004,0x20178008,0x1000000,};
+      jj_la1_1 = new int[] 
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x28000,0x28000,0x20000,0x30000,0x0,0x0,0x0,0x0,0x0,0x2120000,0xa028000,0x800000,0xa028000,0xa028000,0x1000000,0x2008000,0x20000001,0x20008,0x100000,0x1000000,0x20000001,0x0,0x28000,0x2028000,0x420004,0x420004,0x28000,0x78008,0x20078008,0x20000,0x1000000,0x1000000,0x2120000,0x100000,0x28000,0x28000,0x28000,0x28000,0x400004,0x28000,0x400004,0x20178008,0x1000000,};
    }
    private static void jj_la1_init_2() {
-      jj_la1_2 = new int[] 
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x0,0x0,0x0,0x0,0x0,};
+      jj_la1_2 = new int[] 
{0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
    }
   final private JJCalls[] jj_2_rtns = new JJCalls[2];
   private boolean jj_rescan = false;
@@ -2013,7 +2122,7 @@
     token = new Token();
     token.next = jj_nt = token_source.getNextToken();
     jj_gen = 0;
-    for (int i = 0; i < 43; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 50; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -2028,7 +2137,7 @@
     token = new Token();
     token.next = jj_nt = token_source.getNextToken();
     jj_gen = 0;
-    for (int i = 0; i < 43; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 50; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -2039,7 +2148,7 @@
     token = new Token();
     token.next = jj_nt = token_source.getNextToken();
     jj_gen = 0;
-    for (int i = 0; i < 43; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 50; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -2050,7 +2159,7 @@
     token = new Token();
     token.next = jj_nt = token_source.getNextToken();
     jj_gen = 0;
-    for (int i = 0; i < 43; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 50; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -2060,7 +2169,7 @@
     token = new Token();
     token.next = jj_nt = token_source.getNextToken();
     jj_gen = 0;
-    for (int i = 0; i < 43; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 50; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -2070,7 +2179,7 @@
     token = new Token();
     token.next = jj_nt = token_source.getNextToken();
     jj_gen = 0;
-    for (int i = 0; i < 43; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 50; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -2180,7 +2289,7 @@
       la1tokens[jj_kind] = true;
       jj_kind = -1;
     }
-    for (int i = 0; i < 43; i++) {
+    for (int i = 0; i < 50; i++) {
       if (jj_la1[i] == jj_gen) {
         for (int j = 0; j < 32; j++) {
           if ((jj_la1_0[i] & (1<<j)) != 0) {

Modified: gate/trunk/src/main/gate/jape/parser/ParseCpsl.jj
===================================================================
--- gate/trunk/src/main/gate/jape/parser/ParseCpsl.jj   2016-06-22 01:23:02 UTC 
(rev 19433)
+++ gate/trunk/src/main/gate/jape/parser/ParseCpsl.jj   2016-06-22 11:56:23 UTC 
(rev 19434)
@@ -158,6 +158,19 @@
   }
 
   /**
+   * Normalise for quoted and unquoted strings - if the token is a string,
+   * strip the quotes off its image, otherwise return the image as-is.
+   */
+  protected String stringValueOf(Token tok) {
+    if(tok.kind == string) {
+      // quoted string - strip the quotes
+      return tok.image.substring(1, tok.image.length() - 1);
+    } else {
+      return tok.image;
+    }
+  }
+
+  /**
    * Append the given string to the end of the given buffer as a Java string
    * literal.  If <code>str</code> is <code>null</code>, we append the four
    * characters n, u, l, l.  Otherwise, we append the contents of str 
surrounded
@@ -698,7 +711,7 @@
   (
     (
       <input>
-      (inputTok = <ident> {t.addInput(inputTok.image);})*
+      ( ( inputTok = <ident> | inputTok = <string> ) 
{t.addInput(stringValueOf(inputTok));})*
     )
     |
     (
@@ -1105,9 +1118,9 @@
   (<pling> { negate = true; } )?
 
   // the annotation type
-  annotTypeTok=<ident>
+  ( annotTypeTok=<ident> | annotTypeTok = <string> )
   {
-    c = Factory.getConstraintFactory().createConstraint(annotTypeTok.image);
+    c = 
Factory.getConstraintFactory().createConstraint(stringValueOf(annotTypeTok));
     if(negate) c.negate();
   }
 
@@ -1164,10 +1177,10 @@
 }
 {
   (
-    <period> attrNameTok=<ident>
+    <period> ( attrNameTok=<ident> | attrNameTok = <string> )
   )
   {
-    accessor = 
Factory.getConstraintFactory().createDefaultAccessor(attrNameTok.image);
+    accessor = 
Factory.getConstraintFactory().createDefaultAccessor(stringValueOf(attrNameTok));
     return accessor;
   }
 }
@@ -1430,9 +1443,9 @@
   }
 
   // the type of the new annotation we want to create
-  <period> nameTok=<ident>
+  <period> ( nameTok=<ident> | nameTok = <string> )
   {
-    newAnnotType = nameTok.image;
+    newAnnotType = stringValueOf(nameTok);
 
     // start of the attribute stuff
     blockBuffer.append("      java.lang.Object val = null;" + nl);
@@ -1445,7 +1458,7 @@
   (
 
     // the name of the attribute, and equals sign
-    nameTok=<ident> <assign> { newAttrName = nameTok.image; }
+    ( nameTok=<ident> | nameTok = <string> ) <assign> { newAttrName = 
stringValueOf(nameTok); }
 
     // the value to assign
     (
@@ -1525,9 +1538,9 @@
         (
           (
             // WORKING
-            <period> nameTok=<ident> { existingAnnotType = nameTok.image; }
-            (opTok=<period> | opTok=<metaPropOp>) nameTok=<ident>
-              { opName = opTok.image; existingAttrName = nameTok.image; }
+            <period> ( nameTok=<ident> | nameTok = <string> ) { 
existingAnnotType = stringValueOf(nameTok); }
+            (opTok=<period> | opTok=<metaPropOp>) (nameTok=<ident> | 
nameTok=<string>)
+              { opName = opTok.image; existingAttrName = 
stringValueOf(nameTok); }
     
             // for each existingAnnotType annotation in existingAnnotSetAnnots
             //   if there is an attribute with existingAttrName

Modified: gate/trunk/src/main/gate/jape/parser/ParseCpslPlain.html
===================================================================
--- gate/trunk/src/main/gate/jape/parser/ParseCpslPlain.html    2016-06-22 
01:23:02 UTC (rev 19433)
+++ gate/trunk/src/main/gate/jape/parser/ParseCpslPlain.html    2016-06-22 
11:56:23 UTC (rev 19434)
@@ -799,7 +799,7 @@
 <TR>
 <TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod6">SinglePhaseTransducer</A></TD>
 <TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
-<TD ALIGN=LEFT VALIGN=BASELINE>&lt;phase&gt; &lt;ident&gt; ( ( &lt;input&gt; ( 
&lt;ident&gt; )* ) | ( &lt;option&gt; ( &lt;ident&gt; &lt;assign&gt; ( 
&lt;ident&gt; | &lt;bool&gt; ) )* ) )* ( ( <A HREF="#prod7">Rule</A> ) | <A 
HREF="#prod8">MacroDef</A> | <A HREF="#prod9">TemplateDef</A> )*</TD>
+<TD ALIGN=LEFT VALIGN=BASELINE>&lt;phase&gt; &lt;ident&gt; ( ( &lt;input&gt; ( 
( &lt;ident&gt; | &lt;string&gt; ) )* ) | ( &lt;option&gt; ( &lt;ident&gt; 
&lt;assign&gt; ( &lt;ident&gt; | &lt;bool&gt; ) )* ) )* ( ( <A 
HREF="#prod7">Rule</A> ) | <A HREF="#prod8">MacroDef</A> | <A 
HREF="#prod9">TemplateDef</A> )*</TD>
 </TR>
  <!-- Special token -->
  <TR>
@@ -961,7 +961,7 @@
 <TR>
 <TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod19">Constraint</A></TD>
 <TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
-<TD ALIGN=LEFT VALIGN=BASELINE>( &lt;pling&gt; )? &lt;ident&gt; ( ( <A 
HREF="#prod21">FeatureAccessor</A> &lt;attrOp&gt; <A HREF="#prod15">AttrVal</A> 
) | ( &lt;metaPropOp&gt; &lt;ident&gt; &lt;attrOp&gt; <A 
HREF="#prod15">AttrVal</A> ) | ( &lt;ident&gt; ( ( &lt;leftBrace&gt; <A 
HREF="#prod19">Constraint</A> &lt;rightBrace&gt; ) | ( <A 
HREF="#prod19">Constraint</A> ) ) ) )?</TD>
+<TD ALIGN=LEFT VALIGN=BASELINE>( &lt;pling&gt; )? ( &lt;ident&gt; | 
&lt;string&gt; ) ( ( <A HREF="#prod21">FeatureAccessor</A> &lt;attrOp&gt; <A 
HREF="#prod15">AttrVal</A> ) | ( &lt;metaPropOp&gt; &lt;ident&gt; 
&lt;attrOp&gt; <A HREF="#prod15">AttrVal</A> ) | ( &lt;ident&gt; ( ( 
&lt;leftBrace&gt; <A HREF="#prod19">Constraint</A> &lt;rightBrace&gt; ) | ( <A 
HREF="#prod19">Constraint</A> ) ) ) )?</TD>
 </TR>
  <!-- Special token -->
  <TR>
@@ -977,7 +977,7 @@
 <TR>
 <TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod21">FeatureAccessor</A></TD>
 <TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
-<TD ALIGN=LEFT VALIGN=BASELINE>( &lt;period&gt; &lt;ident&gt; )</TD>
+<TD ALIGN=LEFT VALIGN=BASELINE>( &lt;period&gt; ( &lt;ident&gt; | 
&lt;string&gt; ) )</TD>
 </TR>
  <!-- Special token -->
  <TR>
@@ -1078,7 +1078,7 @@
 <TR>
 <TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod25">AssignmentExpression</A></TD>
 <TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
-<TD ALIGN=LEFT VALIGN=BASELINE>( &lt;colon&gt; | &lt;colonplus&gt; ) 
&lt;ident&gt; &lt;period&gt; &lt;ident&gt; &lt;assign&gt; &lt;leftBrace&gt; ( 
&lt;ident&gt; &lt;assign&gt; ( <A HREF="#prod15">AttrVal</A> | ( &lt;colon&gt; 
&lt;ident&gt; ( ( &lt;period&gt; &lt;ident&gt; ( &lt;period&gt; | 
&lt;metaPropOp&gt; ) &lt;ident&gt; ) | ( &lt;metaPropOp&gt; &lt;ident&gt; ) ) ) 
) ( &lt;comma&gt; )? )* &lt;rightBrace&gt;</TD>
+<TD ALIGN=LEFT VALIGN=BASELINE>( &lt;colon&gt; | &lt;colonplus&gt; ) 
&lt;ident&gt; &lt;period&gt; ( &lt;ident&gt; | &lt;string&gt; ) &lt;assign&gt; 
&lt;leftBrace&gt; ( ( &lt;ident&gt; | &lt;string&gt; ) &lt;assign&gt; ( <A 
HREF="#prod15">AttrVal</A> | ( &lt;colon&gt; &lt;ident&gt; ( ( &lt;period&gt; ( 
&lt;ident&gt; | &lt;string&gt; ) ( &lt;period&gt; | &lt;metaPropOp&gt; ) ( 
&lt;ident&gt; | &lt;string&gt; ) ) | ( &lt;metaPropOp&gt; &lt;ident&gt; ) ) ) ) 
( &lt;comma&gt; )? )* &lt;rightBrace&gt;</TD>
 </TR>
  <!-- Special token -->
  <TR>

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to