Commits

Georg Brandl committed 115a402

Changelog entry and coding style fixes.

Comments (0)

Files changed (3)

   * DTD
   * Gosu
   * Octave (PR#22)
+  * Standard ML (PR#14)
 
 - In the LaTeX formatter, escape special &, < and > chars (#648).
 

pygments/lexers/_mapping.py

     'RubyConsoleLexer': ('pygments.lexers.agile', 'Ruby irb session', ('rbcon', 'irb'), (), ('text/x-ruby-shellsession',)),
     'RubyLexer': ('pygments.lexers.agile', 'Ruby', ('rb', 'ruby', 'duby'), ('*.rb', '*.rbw', 'Rakefile', '*.rake', '*.gemspec', '*.rbx', '*.duby'), ('text/x-ruby', 'application/x-ruby')),
     'SLexer': ('pygments.lexers.math', 'S', ('splus', 's', 'r'), ('*.S', '*.R'), ('text/S-plus', 'text/S', 'text/R')),
-    'SMLLexer': ('pygments.lexers.functional', 'Standard ML', ('sml',), ('*.sml', '*.sig', '*.fun'), ('text/x-standard-ml',)),
+    'SMLLexer': ('pygments.lexers.functional', 'Standard ML', ('sml',), ('*.sml', '*.sig', '*.fun'), ('text/x-standardml', 'application/x-standardml')),
     'SassLexer': ('pygments.lexers.web', 'Sass', ('sass', 'SASS'), ('*.sass',), ('text/x-sass',)),
     'ScalaLexer': ('pygments.lexers.compiled', 'Scala', ('scala',), ('*.scala',), ('text/x-scala',)),
     'ScamlLexer': ('pygments.lexers.web', 'Scaml', ('scaml', 'SCAML'), ('*.scaml',), ('text/x-scaml',)),

pygments/lexers/functional.py

      String, Number, Punctuation, Literal, Generic, Error
 
 
-__all__ = ['SchemeLexer', 'CommonLispLexer', 'HaskellLexer', 'LiterateHaskellLexer',
-           'SMLLexer', 
-           'OcamlLexer', 'ErlangLexer', 'ErlangShellLexer']
+__all__ = ['SchemeLexer', 'CommonLispLexer', 'HaskellLexer',
+           'LiterateHaskellLexer', 'SMLLexer', 'OcamlLexer', 'ErlangLexer',
+           'ErlangShellLexer']
 
 
 class SchemeLexer(RegexLexer):
 class SMLLexer(RegexLexer):
     """
     For the Standard ML language.
+
+    *New in Pygments 1.5.*
     """
 
     name = 'Standard ML'
     mimetypes = ['text/x-standardml', 'application/x-standardml']
 
     alphanumid_reserved = [
-      # Core 
-      'abstype', 'and', 'andalso', 'as', 'case', 'datatype', 'do', 'else',
-      'end', 'exception', 'fn', 'fun', 'handle', 'if', 'in', 'infix', 
-      'infixr', 'let', 'local', 'nonfix', 'of', 'op', 'open', 'orelse',
-      'raise', 'rec', 'then', 'type', 'val', 'with', 'withtype', 'while',
-      # Modules
-      'eqtype', 'functor', 'include', 'sharing', 'sig', 'signature',
-      'struct', 'structure', 'where',
+        # Core
+        'abstype', 'and', 'andalso', 'as', 'case', 'datatype', 'do', 'else',
+        'end', 'exception', 'fn', 'fun', 'handle', 'if', 'in', 'infix',
+        'infixr', 'let', 'local', 'nonfix', 'of', 'op', 'open', 'orelse',
+        'raise', 'rec', 'then', 'type', 'val', 'with', 'withtype', 'while',
+        # Modules
+        'eqtype', 'functor', 'include', 'sharing', 'sig', 'signature',
+        'struct', 'structure', 'where',
     ]
 
     symbolicid_reserved = [
-      # Core 
-      ':', '\|', '=', '=>', '->', '#',
-      # Modules
-      ':>',
+        # Core
+        ':', '\|', '=', '=>', '->', '#',
+        # Modules
+        ':>',
     ]
 
     nonid_reserved = [ '(', ')', '[', ']', '{', '}', ',', ';', '...', '_' ]
 
     # A character constant is a sequence of the form #s, where s is a string
     # constant denoting a string of size one character. This setup just parses
-    # the entire string as either a String.Double or a String.Char (depending 
-    # on the argument), even if the String.Char is an erronous 
-    # multiple-character string. 
+    # the entire string as either a String.Double or a String.Char (depending
+    # on the argument), even if the String.Char is an erronous
+    # multiple-character string.
     def stringy (whatkind):
         return [
             (r'[^"\\]', whatkind),
         if match.group(1) in self.alphanumid_reserved: token = Error
         else: token = Name.Namespace
         yield match.start(1), token, match.group(1)
-        yield match.start(2), Punctuation, match.group(2) 
+        yield match.start(2), Punctuation, match.group(2)
 
     def end_id_callback(self, match):
         if match.group(1) in self.alphanumid_reserved: token = Error
         elif match.group(1) in self.symbolicid_reserved: token = Error
         else: token = Name
         yield match.start(1), token, match.group(1)
-        
+
     def id_callback(self, match):
         str = match.group(1)
         if str in self.alphanumid_reserved: token = Keyword.Reserved
 
         'delimiters': [
             # This lexer treats these delimiters specially:
-            # Delimiters define scopes, and the scope is how the meaning of 
+            # Delimiters define scopes, and the scope is how the meaning of
             # the `|' is resolved - is it a case/handle expression, or function
             # definition by cases? (This is not how the Definition works, but
             # it's how MLton behaves, see http://mlton.org/SMLNJDeviations)
 
         'core': [
             # Punctuation that doesn't overlap symbolic identifiers
-            (r'(%s)' % '|'.join([re.escape(z) for z in nonid_reserved]), 
+            (r'(%s)' % '|'.join([re.escape(z) for z in nonid_reserved]),
              Punctuation),
 
             # Special constants: strings, floats, numbers in decimal and hex
             (r'~?\d+\.\d+[eE]~?\d+', Number.Float),
             (r'~?\d+\.\d+', Number.Float),
             (r'~?\d+[eE]~?\d+', Number.Float),
-            (r'~?\d+', Number.Integer),                        
+            (r'~?\d+', Number.Integer),
 
             # Labels
             (r'#\s*[1-9][0-9]*', Name.Label),
 
 
         # Main parser (prevents errors in files that have scoping errors)
-        'root': [ (r'', Text, 'main') ], 
+        'root': [ (r'', Text, 'main') ],
 
-        # In this scope, I expect '|' to not be followed by a function name, 
+        # In this scope, I expect '|' to not be followed by a function name,
         # and I expect 'and' to be followed by a binding site
-        'main': [            
+        'main': [
             include('whitespace'),
 
             # Special behavior of val/and/fun
             (r'\b(val|and)\b(?!\')', Keyword.Reserved, 'vname'),
-            (r'\b(fun)\b(?!\')', Keyword.Reserved, 
+            (r'\b(fun)\b(?!\')', Keyword.Reserved,
              ('#pop', 'main-fun', 'fname')),
 
             include('delimiters'),
             include('core'),
-            (r'\S+', Error),            
+            (r'\S+', Error),
         ],
 
         # In this scope, I expect '|' and 'and' to be followed by a function
 
             # Special behavior of val/and/fun
             (r'\b(fun|and)\b(?!\')', Keyword.Reserved, 'fname'),
-            (r'\b(val)\b(?!\')', Keyword.Reserved, 
+            (r'\b(val)\b(?!\')', Keyword.Reserved,
              ('#pop', 'main', 'vname')),
 
             # Special behavior of '|' and '|'-manipulating keywords
 
             include('delimiters'),
             include('core'),
-            (r'\S+', Error),            
+            (r'\S+', Error),
         ],
 
         # Character and string parsers
             include('breakout'),
 
             (r'(%s)' % alphanumid_re, Name.Namespace),
-            (r'', Text, '#pop'),            
+            (r'', Text, '#pop'),
         ],
 
         # Dealing with what comes after the 'fun' (or 'and' or '|') keyword
             (r'\(', Punctuation, 'tyvarseq'),
 
             (r'(%s)' % alphanumid_re, Name.Function, '#pop'),
-            (r'(%s)' % symbolicid_re, Name.Function, '#pop'), 
+            (r'(%s)' % symbolicid_re, Name.Function, '#pop'),
 
             # Ignore interesting function declarations like "fun (x + y) = ..."
-            (r'', Text, '#pop'), 
+            (r'', Text, '#pop'),
         ],
 
         # Dealing with what comes after the 'val' (or 'and') keyword
             (r'\'[0-9a-zA-Z_\']*', Name.Decorator),
             (r'\(', Punctuation, 'tyvarseq'),
 
-            (r'(%s)(\s*)(=(?!%s))' % (alphanumid_re, symbolicid_re), 
+            (r'(%s)(\s*)(=(?!%s))' % (alphanumid_re, symbolicid_re),
              bygroups(Name.Variable, Text, Punctuation), '#pop'),
-            (r'(%s)(\s*)(=(?!%s))' % (symbolicid_re, symbolicid_re), 
-             bygroups(Name.Variable, Text, Punctuation), '#pop'), 
+            (r'(%s)(\s*)(=(?!%s))' % (symbolicid_re, symbolicid_re),
+             bygroups(Name.Variable, Text, Punctuation), '#pop'),
             (r'(%s)' % alphanumid_re, Name.Variable, '#pop'),
             (r'(%s)' % symbolicid_re, Name.Variable, '#pop'),
 
             # Ignore interesting patterns like 'val (x, y)'
-            (r'', Text, '#pop'), 
+            (r'', Text, '#pop'),
         ],
 
         # Dealing with what comes after the 'type' (or 'and') keyword
 
             (r'(%s)' % alphanumid_re, Keyword.Type),
             (r'(%s)' % symbolicid_re, Keyword.Type),
-            (r'\S+', Error, '#pop'),            
+            (r'\S+', Error, '#pop'),
         ],
 
         # A type binding includes most identifiers
 
             include('breakout'),
             include('core'),
-            (r'\S+', Error, '#pop'),            
+            (r'\S+', Error, '#pop'),
         ],
 
         # Dealing with what comes after the 'datatype' (or 'and') keyword
 
             (r'\'[0-9a-zA-Z_\']*', Name.Decorator),
             (r'\(', Punctuation, 'tyvarseq'),
-            (r'(=)(\s*)(datatype)', 
-             bygroups(Punctuation, Text, Keyword.Reserved), '#pop'), 
-            (r'=(?!%s)' % symbolicid_re, Punctuation, 
+            (r'(=)(\s*)(datatype)',
+             bygroups(Punctuation, Text, Keyword.Reserved), '#pop'),
+            (r'=(?!%s)' % symbolicid_re, Punctuation,
              ('#pop', 'datbind', 'datcon')),
 
             (r'(%s)' % alphanumid_re, Keyword.Type),
             (r'(%s)' % symbolicid_re, Keyword.Type),
-            (r'\S+', Error, '#pop'),            
+            (r'\S+', Error, '#pop'),
         ],
 
-        # common case - A | B | C of int 
+        # common case - A | B | C of int
         'datbind': [
             include('whitespace'),
 
 
             include('breakout'),
             include('core'),
-            (r'\S+', Error),            
+            (r'\S+', Error),
         ],
 
         # Dealing with what comes after an exception
 
             include('breakout'),
             include('core'),
-            (r'\S+', Error),            
+            (r'\S+', Error),
         ],
 
         'datcon': [
             include('whitespace'),
             (r'(%s)' % alphanumid_re, Name.Class, '#pop'),
-            (r'(%s)' % symbolicid_re, Name.Class, '#pop'), 
-            (r'\S+', Error, '#pop'),            
+            (r'(%s)' % symbolicid_re, Name.Class, '#pop'),
+            (r'\S+', Error, '#pop'),
         ],
 
         # Series of type variables
             (r'\'[0-9a-zA-Z_\']*', Name.Decorator),
             (r',', Punctuation),
             (r'\)', Punctuation, '#pop'),
-            (r'', Error, '#pop'),            
+            (r'', Error, '#pop'),
         ],
 
         'comment': [
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.