Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Unified Diff: tools/lexer_generator/rule_lexer.py

Issue 138973007: Experimental parser: support subgraph inlining (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/lexer_generator/regex_parser.py ('k') | tools/lexer_generator/rule_parser.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lexer_generator/rule_lexer.py
diff --git a/tools/lexer_generator/rule_lexer.py b/tools/lexer_generator/rule_lexer.py
deleted file mode 100644
index f3dcf9e3ee3e2d3fa5d60e6c0da6475ff66fcdf2..0000000000000000000000000000000000000000
--- a/tools/lexer_generator/rule_lexer.py
+++ /dev/null
@@ -1,101 +0,0 @@
-# Copyright 2013 the V8 project authors. All rights reserved.
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-import ply.lex as lex
-
-class RuleLexer:
-
- tokens = (
- 'DEFAULT_ACTION',
- 'EOS',
- 'CATCH_ALL',
-
- 'IDENTIFIER',
- 'STRING',
- 'REGEX',
- 'CHARACTER_CLASS_REGEX',
-
- 'PLUS',
- 'QUESTION_MARK',
- 'EQUALS',
- 'OR',
- 'STAR',
- 'LEFT_PARENTHESIS',
- 'RIGHT_PARENTHESIS',
- 'GRAPH_OPEN',
- 'GRAPH_CLOSE',
- 'SEMICOLON',
- 'ACTION_OPEN',
- 'ACTION_CLOSE',
-
- 'COMMA',
- )
-
- t_ignore = " \t\n\r"
-
- def t_COMMENT(self, t):
- r'\#.*[\n\r]+'
- pass
-
- __special_identifiers = set(map(lambda s: s.lower(),
- ['DEFAULT_ACTION', 'CATCH_ALL', 'EOS']))
-
- def t_IDENTIFIER(self, t):
- r'[a-zA-Z0-9_]+'
- if t.value in self.__special_identifiers:
- t.type = t.value.upper()
- return t
-
- t_STRING = r'"((\\("|\w|\\))|[^\\"])+"'
- t_REGEX = r'/(\\/|[^/])+/'
- t_CHARACTER_CLASS_REGEX = r'\[([^\]]|\\\])+\]'
-
- t_PLUS = r'\+'
- t_QUESTION_MARK = r'\?'
- t_STAR = r'\*'
- t_OR = r'\|'
- t_EQUALS = '='
- t_LEFT_PARENTHESIS = r'\('
- t_RIGHT_PARENTHESIS = r'\)'
- t_GRAPH_OPEN = '<<'
- t_GRAPH_CLOSE = '>>'
- t_SEMICOLON = ';'
- t_ACTION_OPEN = '<'
- t_ACTION_CLOSE = '>'
- t_COMMA = ','
-
- def t_LEFT_BRACKET(self, t):
- r'{'
- self.lexer.push_state('code')
- self.nesting = 1
- return t
-
- def t_ANY_error(self, t):
- raise Exception("Illegal character '%s'" % t.value[0])
-
- def build(self, **kwargs):
- self.lexer = lex.lex(module=self, **kwargs)
« no previous file with comments | « tools/lexer_generator/regex_parser.py ('k') | tools/lexer_generator/rule_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698