Skip to content

Commit

Permalink
Merge pull request #2135 from usethesource/missing-formfeed
Browse files Browse the repository at this point in the history
Added missing translation of \f and \b
  • Loading branch information
PieterOlivier authored Jan 29, 2025
2 parents 1bb6b4b + 78117e8 commit 4c2060a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/org/rascalmpl/library/String.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ str deescape(str s) {
case /^\\<c: [\" \' \< \> \\]>/ => c
case /^\\t/ => "\t"
case /^\\n/ => "\n"
case /^\\f/ => "\f"
case /^\\b/ => "\b"
case /^\\u<hex:[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]>/ => stringChar(toInt("0x<hex>"))
case /^\\U<hex:[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]>/ => stringChar(toInt("0x<hex>"))
case /^\\a<hex:[0-7][0-9a-fA-F]>/ => stringChar(toInt("0x<hex>"))
Expand Down
2 changes: 2 additions & 0 deletions src/org/rascalmpl/values/parsetrees/SymbolFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ private static IValue char2int(Char character) {
case 't': return factory.integer('\t');
case 'n': return factory.integer('\n');
case 'r': return factory.integer('\r');
case 'f': return factory.integer('\f');
case 'b': return factory.integer('\b');
case '\"' : return factory.integer('\"');
case '\'' : return factory.integer('\'');
case '-' : return factory.integer('-');
Expand Down

0 comments on commit 4c2060a

Please sign in to comment.