Ticket #166: ticket166.patch
File ticket166.patch, 2.6 KB (added by webnov8, 15 years ago) |
---|
-
Source/CobraTokenizer.cobra
121 121 r'UINT_SIZE uint[0-9]+(?=[^A-Za-z0-9_])', 122 122 r'FLOAT_SIZE float[0-9]+(?=[^A-Za-z0-9_])', 123 123 124 r"CHAR_LIT_SINGLE c' \\?.'",125 r'CHAR_LIT_DOUBLE c" \\?."',124 r"CHAR_LIT_SINGLE c'(?:\\'|\\?[^'])'", 125 r'CHAR_LIT_DOUBLE c"(?:\\"|\\?[^"])"', 126 126 127 127 # doc strings 128 128 r'DOC_STRING_START """[ \t]*\n', 129 129 r'DOC_STRING_LINE """.*"""[ \t]*\n', 130 130 131 131 # sharp strings 132 r"SHARP_SINGLE sharp' [^'\n]*'",133 r'SHARP_DOUBLE sharp" [^"\n]*"',132 r"SHARP_SINGLE sharp'(?:\\.?|[^'\n])*'", 133 r'SHARP_DOUBLE sharp"(?:\\.?|[^"\n])*"', 134 134 135 135 # raw strings 136 r"STRING_RAW_SINGLE r' [^'\n]*'",137 r'STRING_RAW_DOUBLE r" [^"\n]*"',136 r"STRING_RAW_SINGLE r'(?:\\.?|[^'\n])*'", 137 r'STRING_RAW_DOUBLE r"(?:\\.?|[^"\n])*"', 138 138 139 139 # substituted strings 140 140 r'RBRACKET_SPECIAL ]', … … 149 149 r'STRING_PART_FORMAT :[^X"\n\[]*(?=])'.replace('X', "'"), 150 150 151 151 # plain strings 152 r"STRING_NOSUB_SINGLE ns' [^'\n]*'",153 r'STRING_NOSUB_DOUBLE ns" [^"\n]*"',152 r"STRING_NOSUB_SINGLE ns'(?:\\.?|[^'\n])*'", 153 r'STRING_NOSUB_DOUBLE ns"(?:\\.?|[^"\n])*"', 154 154 155 r"STRING_SINGLE ' [^'\n]*'",156 r'STRING_DOUBLE " [^"\n]*"',155 r"STRING_SINGLE '(?:\\.?|[^'\n])*'", 156 r'STRING_DOUBLE "(?:\\.?|[^"\n])*"', 157 157 158 158 r'TOQ to\?', 159 159 r'ID [A-Za-z_][A-Za-z0-9_]*', -
Tests/100-basics/064-1-string-raw.cobra
class ShouldNotCallException inherits Exception
26 26 assert s.length==2 27 27 assert s[0]==c'[' 28 28 assert s[1]==c']' 29 30 assert r'\"' == r"\"" 31 assert r'cobra\language' == r"cobra\language" 32 assert r'[]' == r"[]" -
Tests/100-basics/060-string.cobra
53 53 s = 'aoeu' 54 54 s = s[0].toString + 'b' 55 55 assert s=='ab' 56 57 assert 'cobra\'s lair' == "cobra's lair" 58 assert '"' == "\"" 59 assert '\'' == "'" -
Tests/100-basics/055-char.cobra
20 20 assert c'x'==c 21 21 assert c<>c'y' 22 22 assert c'y'<>c 23 24 assert c'\'' == c"'" 25 assert c"\"" == c'"' 26