diff --git a/src/org/rascalmpl/library/lang/rascal/grammar/tests/CharactersTests.rsc b/src/org/rascalmpl/library/lang/rascal/grammar/tests/CharactersTests.rsc index 0ce18b21159..e55a5db50aa 100644 --- a/src/org/rascalmpl/library/lang/rascal/grammar/tests/CharactersTests.rsc +++ b/src/org/rascalmpl/library/lang/rascal/grammar/tests/CharactersTests.rsc @@ -70,3 +70,12 @@ test bool literalUtf16Escape() = lit("\n") == #"\u000A".symbol; test bool literalUtf32Escape1() = lit("\n") == #"\U00000A".symbol; test bool literalUtf32Escape2() = lit("🍕") == #"\U01F355".symbol; +test bool ciliteralAsciiEscape1() = cilit("\n") == #'\a0A'.symbol; +test bool ciliteralAsciiEscape2() = cilit("w") == #'\a77'.symbol; +test bool ciliteralAsciiEscape3() = cilit("\f") == #'\a0C'.symbol; +test bool ciliteralAsciiEscape4() = cilit("\n") == #'\n'.symbol; +@ignore{vallang must re-introduce the \f notation} +test bool ciliteralAsciiEscape5() = cilit("\f") == #'\f'.symbol; +test bool ciliteralUtf16Escape() = cilit("\n") == #'\u000A'.symbol; +test bool ciliteralUtf32Escape1() = cilit("\n") == #'\U00000A'.symbol; +test bool ciliteralUtf32Escape2() = cilit("🍕") == #'\U01F355'.symbol; diff --git a/src/org/rascalmpl/values/parsetrees/SymbolFactory.java b/src/org/rascalmpl/values/parsetrees/SymbolFactory.java index cec5444b924..d3dac7eb4b1 100644 --- a/src/org/rascalmpl/values/parsetrees/SymbolFactory.java +++ b/src/org/rascalmpl/values/parsetrees/SymbolFactory.java @@ -77,7 +77,7 @@ private static IValue symbolAST2SymbolConstructor(Sym symbol, boolean lex, Strin boolean noExpand = lex || layout == null; if (symbol.isCaseInsensitiveLiteral()) { - return factory.constructor(RascalValueFactory.Symbol_Cilit, ciliteral2Symbol(symbol.getCistring())); + return ciliteral2Symbol(symbol.getCistring()); } if (symbol.isCharacterClass()) { Class cc = symbol.getCharClass(); @@ -220,7 +220,7 @@ private static IValue ciliteral2Symbol(CaseInsensitiveStringConstant constant) { String lit = ((CaseInsensitiveStringConstant.Lexical) constant).getString(); // replace single quotes by double quotes first lit = "\"" + lit.substring(1, lit.length() - 1) + "\""; - + // this should be the exact notation for string literals in vallang IValue string = new StandardTextReader().read(factory, new StringReader(lit));