#BUGFIX by cg
class: Scanner
changed: #escapeCharacterFor:escapeStyle:
handle unterminated escapes gracefully
--- a/Scanner.st Thu Jul 18 07:59:41 2019 +0200
+++ b/Scanner.st Sun Jul 21 08:30:10 2019 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
@@ -145,7 +143,7 @@
extendedBinarySelectorCharacters
"return a collection of characters which are optionally allowed in binary selectors"
- "/ ^ '±×·÷«»'.
+ "/ ^ '±×·÷«»'.
^ String
with:(Character value:16rB1) "/ plus-minus
with:(Character value:16rD7) "/ times
@@ -1863,13 +1861,13 @@
!
warnParagraphAt:position
- "warn about §-character in an identifier"
+ "warn about §-character in an identifier"
ignoreWarnings ifFalse:[
"/ didWarnAboutParagraphInIdentifier ifFalse:[
parserFlags warnParagraphInIdentifier ifTrue:[
self
- warning:'§-characters in identifiers/symbols are nonportable'
+ warning:'§-characters in identifiers/symbols are nonportable'
doNotShowAgainAction:[ ParserFlags warnParagraphInIdentifier:false ]
position:position to:position.
"
@@ -2485,8 +2483,10 @@
(nextChar notNil and:[nextChar isDigitRadix:16]) ifFalse:[
self syntaxError:'hex digit expected in string literal'
position:pos1 to:(source position).
+ 0
+ ] ifTrue:[
+ nextChar digitValue
].
- nextChar digitValue
].
ascii := fetchNext value.
@@ -2519,7 +2519,7 @@
"
"Created: / 11-02-2019 / 12:27:25 / Claus Gittinger"
- "Modified (comment): / 23-05-2019 / 10:34:21 / Claus Gittinger"
+ "Modified: / 21-07-2019 / 08:20:08 / Claus Gittinger"
!
ignoreErrors
@@ -3020,7 +3020,7 @@
(((nextChar == $_) and:[allowUnderscoreInIdentifier])
or:[ (allowDollarInIdentifier and:[nextChar == $$ ])
- or:[ (nextChar == $§ and:[ allowParagraphInIdentifier])
+ or:[ (nextChar == $§ and:[ allowParagraphInIdentifier])
or:[ (allowNationalCharactersInIdentifier and:[ nextChar notNil and:[nextChar isNationalLetter]])
or:[ (allowGreekCharactersInIdentifier and:[ nextChar notNil and:[nextChar isNationalLetter]])
]]]]) ifTrue:[
@@ -3031,7 +3031,7 @@
nextChar == $$ ifTrue:[
self warnDollarAt:pos.
] ifFalse:[
- nextChar == $§ ifTrue:[
+ nextChar == $§ ifTrue:[
self warnParagraphAt:pos.
] ifFalse:[
"/ self warnNationalCharacterAt:pos.
@@ -3051,7 +3051,7 @@
].
ok := ((nextChar == $_) and:[allowUnderscoreInIdentifier])
or:[((nextChar == $$ ) and:[allowDollarInIdentifier])
- or:[((nextChar == $§ ) and:[allowParagraphInIdentifier])
+ or:[((nextChar == $§ ) and:[allowParagraphInIdentifier])
or:[(nextChar notNil and:[allowNationalCharactersInIdentifier and:[nextChar isNationalLetter]])
or:[(nextChar notNil and:[allowGreekCharactersInIdentifier and:[nextChar isGreekLetter]])
]]]].
@@ -3755,7 +3755,7 @@
"/ a nil token means: continue reading
] ifFalse:[
((ch isNationalLetter and:[parserFlags allowNationalCharactersInIdentifier])
- or:[ (ch == $§ and:[parserFlags allowParagraphInIdentifier])
+ or:[ (ch == $§ and:[parserFlags allowParagraphInIdentifier])
or:[ (ch isGreekLetter and:[parserFlags allowGreekCharactersInIdentifier])
]]) ifTrue:[
tok := self nextIdentifier.