Commits

Georg Brandl  committed 7925d53

Closes #750: fix highlighting of quotes inside Smalltalk strings/comments.

  • Participants
  • Parent commits 7527e46

Comments (0)

Files changed (1)

File pygments/lexers/other.py

             (r'\^|\:=|\_', Operator),
             # temporaries
             (r'[\]({}.;!]', Text),
-
         ],
         'method definition' : [
             # Not perfect can't allow whitespaces at the beginning and the
             (r'', Text, '#pop'), # else pop
         ],
         'literals' : [
-            (r'\'[^\']*\'', String, 'afterobject'),
+            (r"'(''|[^'])*'", String, 'afterobject'),
             (r'\$.', String.Char, 'afterobject'),
             (r'#\(', String.Symbol, 'parenth'),
             (r'\)', Text, 'afterobject'),
             (r'(\d+r)?-?\d+(\.\d+)?(e-?\d+)?', Number),
             (r'[-+*/\\~<>=|&#!?,@%\w:]+', String.Symbol),
             # literals
-            (r'\'[^\']*\'', String),
+            (r"'(''|[^'])*'", String),
             (r'\$.', String.Char),
             (r'#*\(', String.Symbol, 'inner_parenth'),
         ],
         'parenth' : [
             # This state is a bit tricky since
             # we can't just pop this state
-            (r'\)', String.Symbol, ('root','afterobject')),
+            (r'\)', String.Symbol, ('root', 'afterobject')),
             include('_parenth_helper'),
         ],
         'inner_parenth': [
         'whitespaces' : [
             # skip whitespace and comments
             (r'\s+', Text),
-            (r'"[^"]*"', Comment),
+            (r'"(""|[^"])*"', Comment),
         ],
         'objects' : [
             (r'\[', Text, 'blockvariables'),
              Name.Builtin.Pseudo, 'afterobject'),
             (r'\b[A-Z]\w*(?!:)\b', Name.Class, 'afterobject'),
             (r'\b[a-z]\w*(?!:)\b', Name.Variable, 'afterobject'),
-            (r'#("[^"]*"|[-+*/\\~<>=|&!?,@%]+|[\w:]+)',
+            (r'#("(""|[^"])*"|[-+*/\\~<>=|&!?,@%]+|[\w:]+)',
              String.Symbol, 'afterobject'),
             include('literals'),
         ],
         ],
         'squeak fileout' : [
             # Squeak fileout format (optional)
-            (r'^"[^"]*"!', Keyword),
-            (r"^'[^']*'!", Keyword),
+            (r'^"(""|[^"])*"!', Keyword),
+            (r"^'(''|[^'])*'!", Keyword),
             (r'^(!)(\w+)( commentStamp: )(.*?)( prior: .*?!\n)(.*?)(!)',
                 bygroups(Keyword, Name.Class, Keyword, String, Keyword, Text, Keyword)),
-            (r'^(!)(\w+(?: class)?)( methodsFor: )(\'[^\']*\')(.*?!)',
+            (r"^(!)(\w+(?: class)?)( methodsFor: )('(?:''|[^'])*')(.*?!)",
                 bygroups(Keyword, Name.Class, Keyword, String, Keyword)),
             (r'^(\w+)( subclass: )(#\w+)'
              r'(\s+instanceVariableNames: )(.*?)'