[ASTERIXDB-3001][MVN] Grammarix not finding all productions

- user model changes: no
- storage format changes: no
- interface changes: no

Grammarix was mishandling the '"' case for quotes, making nearly
all productions after LiteralExpression not extensible.

Change-Id: Ib5d840237ee1224a4225cb67c795f3ac08452a76
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14663
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Dmitry Lychagin <dmitry.lychagin@couchbase.com>
diff --git a/asterixdb/asterix-maven-plugins/asterix-grammar-extension-maven-plugin/src/main/java/org/apache/asterix/extension/grammar/GrammarExtensionMojo.java b/asterixdb/asterix-maven-plugins/asterix-grammar-extension-maven-plugin/src/main/java/org/apache/asterix/extension/grammar/GrammarExtensionMojo.java
index d47e9a6..19bfe1d 100644
--- a/asterixdb/asterix-maven-plugins/asterix-grammar-extension-maven-plugin/src/main/java/org/apache/asterix/extension/grammar/GrammarExtensionMojo.java
+++ b/asterixdb/asterix-maven-plugins/asterix-grammar-extension-maven-plugin/src/main/java/org/apache/asterix/extension/grammar/GrammarExtensionMojo.java
@@ -459,7 +459,9 @@
                         prevCharEscape = chars[bufferPosn] == ExternalDataConstants.ESCAPE;
                     }
                 } else {
-                    if (chars[bufferPosn] == ExternalDataConstants.QUOTE) {
+                    if (chars[bufferPosn] == ExternalDataConstants.QUOTE && chars[bufferPosn] != start
+                            && chars[bufferPosn - 1] != '\'') {
+                        // If we see a quote that is not preceded by an apostrophe, then we are inside a string.
                         inString = true;
                     } else if (chars[bufferPosn] == start) {
                         depth += 1;