Ned Batchelder avatar Ned Batchelder committed e780425 Draft

Remove semicolons (!) and trailing space.

Comments (0)

Files changed (1)

 
 def literals(choices, prefix="", suffix=""):
     """Create a regex from a space-separated list of literal `choices`.
-    
+
     If provided, `prefix` and `suffix` will be attached to each choice
     individually.
 
 
 class JsLexer(Lexer):
     """A Javascript lexer
-    
+
     >>> lexer = JsLexer()
     >>> list(lexer.lex("a = 1"))
     [('id', 'a'), ('ws', ' '), ('punct', '='), ('ws', ' '), ('dnum', '1')]
                                 \.                      # dot
                                 [0-9]*                  # DecimalDigits-opt
                                 ([eE][-+]?[0-9]+)?      # ExponentPart-opt
-                            |   
+                            |
                                 \.                      # dot
                                 [0-9]+                  # DecimalDigits
                                 ([eE][-+]?[0-9]+)?      # ExponentPart-opt
-                            |   
+                            |
                                 (0|[1-9][0-9]*)         # DecimalIntegerLiteral
                                 ([eE][-+]?[0-9]+)?      # ExponentPart-opt
                             )
 
         'reg':  # slash will mean regex
             both_before + [
-            Tok("regex",        
+            Tok("regex",
                 r"""
                     /                       # opening slash
                     # First character is..
 
 def js_to_c_for_gettext(js):
     """Convert the Javascript source `js` into something resembling C for xgettext.
-    
+
     What actually happens is that all the regex literals are replaced with
     "REGEX".
-    
+
     """
     def escape_quotes(m):
         """Used in a regex to properly escape double quotes."""
             return r'\"'
         else:
             return s
-                    
+
     lexer = JsLexer()
     c = []
     for name, tok in lexer.lex(js):
         if name == 'regex':
             # C doesn't grok regexes, and they aren't needed for gettext,
             # so just output a string instead.
-            tok = '"REGEX"';
+            tok = '"REGEX"'
         elif name == 'string':
             # C doesn't have single-quoted strings, so make all strings
             # double-quoted.
             # C can't deal with Unicode escapes in identifiers.  We don't
             # need them for gettext anyway, so replace them with something
             # innocuous
-            tok = tok.replace("\\", "U");
+            tok = tok.replace("\\", "U")
         c.append(tok)
     return ''.join(c)
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.