-redef class ABinIntExpr
- redef fun accept_literal(v)
- do
- var s = self.n_bin_number.text.substring_from(2).remove_underscores
- if s.is_empty then
- v.toolcontext.error(location, "Error: invalid binary literal")
- return
+# Any kind of string form with augmentations from prefixes or suffixes
+class AugmentedStringFormExpr
+ super AAugmentedLiteral
+
+ redef var delimiter_start = '"'
+ redef var delimiter_end = '"'
+
+ # Is `self` a regular String object ?
+ fun is_string: Bool do return prefix == "" or prefix == "raw"
+
+ # Is `self` a Regular Expression ?
+ fun is_re: Bool do return prefix == "re"
+
+ # Is `self` a Byte String ?
+ fun is_bytestring: Bool do return prefix == "b"
+
+ redef fun is_valid_augmentation do
+ if is_string and suffix == "" then return true
+ if is_bytestring and suffix == "" then return true
+ if is_re then
+ var suf = suffix
+ for i in suf.chars do
+ if i == 'i' then continue
+ if i == 'm' then continue
+ if i == 'b' then continue
+ return false
+ end
+ return true