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

Unified Diff: tools/lexer_generator/nfa_builder.py

Issue 143803015: Experimental parser: add comments for NfaBuilder. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lexer_generator/nfa_builder.py
diff --git a/tools/lexer_generator/nfa_builder.py b/tools/lexer_generator/nfa_builder.py
index 5ff7e242b90cd08b944c5ecacee3a57695be3159..af170e439c2bc2fa22b314e661c82bcf939fd5aa 100644
--- a/tools/lexer_generator/nfa_builder.py
+++ b/tools/lexer_generator/nfa_builder.py
@@ -29,6 +29,15 @@ from types import TupleType
from inspect import getmembers
from nfa import *
+# Nfa is built in two stages:
+# 1. Build a tree of operations on rules.
+# Each node in the tree is a tuple (operation, subtree1, ... subtreeN).
+# Rule parser builds this tree by invoking static methods of NfaBuilder.
+# 2. For each node, perform the operation of the node to produce an Nfa.
+# If an operation is called X, then it is performed by the method
+# of NfaBuilder called __x(). See __process() for mapping from
+# operation to processing methods.
+
class NfaBuilder(object):
def __init__(self, encoding, character_classes = {}):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698