Some cleanup of comments and error messages.
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Tue, 23 Jan 2007 04:42:30 +0000 (04:42 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Tue, 23 Jan 2007 04:42:30 +0000 (04:42 +0000)
git-svn-id: http://svn.complang.org/ragel/trunk@8 052ea7fc-9027-0410-9066-f65837a77df0

ragel/parsetree.cpp
ragel/rlparse.kh
ragel/rlparse.kl
ragel/rlscan.rl

index 11c58fa..9764c7f 100644 (file)
@@ -1922,6 +1922,7 @@ FsmAp *RegExpr::walk( ParseData *pd, RegExpr *rootRegex )
                        break;
                }
                case Empty: {
+                       /* FIXME: Return something here. */
                        rtnVal = 0;
                        break;
                }
index 5d7b404..fe983fa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2006 Adrian Thurston <thurston@cs.queensu.ca>
+ *  Copyright 2001-2007 Adrian Thurston <thurston@cs.queensu.ca>
  */
 
 /*  This file is part of Ragel.
index 28fcfcc..dde23ec 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2006 Adrian Thurston <thurston@cs.queensu.ca>
+ *  Copyright 2001-2007 Adrian Thurston <thurston@cs.queensu.ca>
  */
 
 /*  This file is part of Ragel.
@@ -82,8 +82,6 @@ nonterm machine_name uses token_type;
 
 machine_name: 
        TK_Word final {
-               //cerr << "parser: machine name" << endl;
-
                /* Make/get the priority key. The name may have already been referenced
                 * and therefore exist. */
                PriorDictEl *priorDictEl;
@@ -282,6 +280,8 @@ expression:
                $$->expression = new Expression( $1->expression, 
                                $3->term, Expression::IntersectType );
        };
+# This priority specification overrides the innermost parsing strategy which
+# results ordered choice interpretation of the grammar.
 expression: 
        expression pri(1) '-' term final {
                $$->expression = new Expression( $1->expression, 
@@ -304,7 +304,6 @@ nonterm term
 
 term:
        term factor_with_label final {
-               /* FIXME: Need to reject this if of the form (term . -num). */
                $$->term = new Term( $1->term, $2->factorWithAug );
        };
 term:
index d35ff7c..7685e70 100644 (file)
@@ -216,17 +216,12 @@ void Scanner::token( int type )
        {
                /* Assign a name to the machine. */
                char *machine = word;
-               //cerr << "scanner: machine statement: " << machine << endl;
 
                if ( inclSectionTarg == 0 ) {
                        active = true;
 
                        ParserDictEl *pdEl = parserDict.find( machine );
-                       if ( pdEl != 0 ) {
-                               //cerr << "scanner: using existing parser" << endl;
-                       }
-                       else {
-                               //cerr << "scanner: creating a new parser" << endl;
+                       if ( pdEl == 0 ) {
                                pdEl = new ParserDictEl( machine );
                                pdEl->value = new Parser( fileName, machine, sectionLoc );
                                pdEl->value->init();
@@ -236,12 +231,12 @@ void Scanner::token( int type )
                        parser = pdEl->value;
                }
                else if ( strcmp( inclSectionTarg, machine ) == 0 ) {
-                       //cerr << "scanner: found include target" << endl;
+                       /* found include target */
                        active = true;
                        parser = inclToParser;
                }
                else {
-                       //cerr << "scanner: ignoring section" << endl;
+                       /* ignoring section */
                        active = false;
                        parser = 0;
                }
@@ -266,9 +261,6 @@ void Scanner::token( int type )
                        else
                                inclFileName = fileName;
 
-                       /* Open the file and process it. */
-                       //cerr << "scanner: include: " << inclSectionName << " " << inclFileName << endl;
-
                        /* Check for a recursive include structure. Add the current file/section
                         * name then check if what we are including is already in the stack. */
                        includeStack.append( IncludeStackItem( fileName, parser->sectionName ) );
@@ -867,7 +859,6 @@ void Scanner::do_scan()
                        /* We filled up the buffer trying to scan a token. Grow it. */
                        bufsize = bufsize * 2;
                        char *newbuf = new char[bufsize];
-                       //cerr << "FULL BUFFER, NEW SIZE: " << bufsize << endl;
 
                        /* Recompute p and space. */
                        p = newbuf + have;
@@ -898,8 +889,9 @@ void Scanner::do_scan()
 
                /* Check if we failed. */
                if ( cs == rlscan_error ) {
-                       /* Machine failed before finding a token. */
-                       //cerr << "PARSE ERROR" << endl;
+                       /* Machine failed before finding a token. I'm not yet sure if this
+                        * is reachable. */
+                       error() << "scanner error" << endl;
                        exit(1);
                }