Changes in / [fbcb354:326338ae]


Ignore:
Files:
3 deleted
29 edited

Legend:

Unmodified
Added
Removed
  • doc/LaTeXmacros/common.tex

    rfbcb354 r326338ae  
    1111%% Created On       : Sat Apr  9 10:06:17 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Mon Aug 28 20:18:42 2017
    14 %% Update Count     : 355
     13%% Last Modified On : Mon Jul 24 21:02:14 2017
     14%% Update Count     : 352
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    148148% Latin abbreviation
    149149\newcommand{\abbrevFont}{\textit}       % set empty for no italics
    150 \newcommand{\EG}{\abbrevFont{e}.\abbrevFont{g}.}
    151150\newcommand*{\eg}{%
    152         \@ifnextchar{,}{\EG}%
    153                 {\@ifnextchar{:}{\EG}%
    154                         {\EG,\xspace}}%
    155 }%
    156 \newcommand{\IE}{\abbrevFont{i}.\abbrevFont{e}.}
     151        \@ifnextchar{,}{\abbrevFont{e}.\abbrevFont{g}.}%
     152                {\@ifnextchar{:}{\abbrevFont{e}.\abbrevFont{g}.}%
     153                        {\abbrevFont{e}.\abbrevFont{g}.,\xspace}}%
     154}%
    157155\newcommand*{\ie}{%
    158         \@ifnextchar{,}{\IE}%
    159                 {\@ifnextchar{:}{\IE}%
    160                         {\IE,\xspace}}%
    161 }%
    162 \newcommand{\ETC}{\abbrevFont{etc}}
     156        \@ifnextchar{,}{\abbrevFont{i}.\abbrevFont{e}.}%
     157                {\@ifnextchar{:}{\abbrevFont{i}.\abbrevFont{e}.}%
     158                        {\abbrevFont{i}.\abbrevFont{e}.,\xspace}}%
     159}%
    163160\newcommand*{\etc}{%
    164         \@ifnextchar{.}{\ETC}%
    165         {\ETC\xspace}%
    166 }%
    167 \newcommand{\ETAL}{\abbrevFont{et\:al}}
     161        \@ifnextchar{.}{\abbrevFont{etc}}%
     162        {\abbrevFont{etc}.\xspace}%
     163}%
    168164\newcommand{\etal}{%
    169         \@ifnextchar{.}{\ETAL}%
    170                 {\abbrevFont{\ETAL}.\xspace}%
    171 }%
    172 \newcommand{\VIZ}{\abbrevFont{viz}}
    173 \newcommand{\viz}{%
    174         \@ifnextchar{.}{\VIZ}%
    175                 {\abbrevFont{\VIZ}.\xspace}%
     165        \@ifnextchar{.}{\abbrevFont{et~al}}%
     166                {\abbrevFont{et al}.\xspace}%
    176167}%
    177168\makeatother
  • doc/LaTeXmacros/lstlang.sty

    rfbcb354 r326338ae  
    88%% Created On       : Sat May 13 16:34:42 2017
    99%% Last Modified By : Peter A. Buhr
    10 %% Last Modified On : Wed Aug 30 22:11:14 2017
    11 %% Update Count     : 14
     10%% Last Modified On : Mon Jul 24 20:40:37 2017
     11%% Update Count     : 13
    1212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1313
     
    112112                finally, forall, ftype, _Generic, _Imaginary, inline, __label__, lvalue, _Noreturn, one_t,
    113113                otype, restrict, _Static_assert, throw, throwResume, trait, try, ttype, typeof, __typeof,
    114                 __typeof__, virtual, waitfor, when, with, zero_t},
     114                __typeof__, virtual, with, zero_t},
    115115        morekeywords=[2]{
    116116                _Atomic, coroutine, is_coroutine, is_monitor, is_thread, monitor, mutex, nomutex,
  • doc/refrat/keywords.tex

    rfbcb354 r326338ae  
    1111%% Created On       : Sun Aug  6 08:17:27 2017
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Wed Aug 30 22:10:10 2017
    14 %% Update Count     : 5
     13%% Last Modified On : Sun Aug  6 08:31:42 2017
     14%% Update Count     : 4
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616\begin{tabular}{@{}llllll@{}}
     
    5252©ttype©                 \\
    5353©virtual©               \\
    54 ©waitfor©               \\
     54©with©                  \\
    5555\end{tabular}
    5656&
    5757\begin{tabular}{@{}l@{}}
    58 ©when©                  \\
    59 ©with©                  \\
    6058©zero_t©                \\
     59                                \\
     60                                \\
    6161                                \\
    6262                                \\
  • src/Common/CodeLocation.h

    rfbcb354 r326338ae  
    99// Author           : Andrew Beach
    1010// Created On       : Thr Aug 17 11:23:00 2017
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Aug 28 12:46:01 2017
    13 // Update Count     : 2
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Aug 17 14:07:00 2017
     13// Update Count     : 0
    1414//
    1515
     
    6666
    6767inline std::string to_string( const CodeLocation& location ) {
    68     // Column number ":1" allows IDEs to parse the error message and position the cursor in the source text.
    69     return location.isSet() ? location.filename + ":" + std::to_string(location.linenumber) + ":1 " : "";
     68    return location.isSet() ? location.filename + ":" + std::to_string(location.linenumber) + " " : "";
    7069}
    7170
  • src/Common/PassVisitor.h

    rfbcb354 r326338ae  
    7575        virtual void visit( CatchStmt *catchStmt ) override final;
    7676        virtual void visit( FinallyStmt *finallyStmt ) override final;
    77         virtual void visit( WaitForStmt *waitforStmt ) override final;
    7877        virtual void visit( NullStmt *nullStmt ) override final;
    7978        virtual void visit( DeclStmt *declStmt ) override final;
     
    160159        virtual Statement* mutate( ReturnStmt *returnStmt ) override final;
    161160        virtual Statement* mutate( ThrowStmt *throwStmt ) override final;
    162         virtual Statement* mutate( TryStmt *tryStmt ) override final;
     161        virtual Statement* mutate( TryStmt *returnStmt ) override final;
    163162        virtual Statement* mutate( CatchStmt *catchStmt ) override final;
    164         virtual Statement* mutate( FinallyStmt *finallyStmt ) override final;
    165         virtual Statement* mutate( WaitForStmt *waitforStmt ) override final;
     163        virtual Statement* mutate( FinallyStmt *catchStmt ) override final;
    166164        virtual NullStmt* mutate( NullStmt *nullStmt ) override final;
    167165        virtual Statement* mutate( DeclStmt *declStmt ) override final;
  • src/Common/PassVisitor.impl.h

    rfbcb354 r326338ae  
    541541}
    542542
    543 //--------------------------------------------------------------------------
    544 // FinallyStmt
    545543template< typename pass_type >
    546544void PassVisitor< pass_type >::visit( FinallyStmt * node ) {
     
    549547
    550548template< typename pass_type >
    551 Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) {
    552         MUTATE_BODY( Statement, node );
    553 }
    554 
    555 //--------------------------------------------------------------------------
    556 // WaitForStmt
    557 template< typename pass_type >
    558 void PassVisitor< pass_type >::visit( WaitForStmt * node ) {
    559         VISIT_BODY( node );
    560 }
    561 
    562 template< typename pass_type >
    563 Statement * PassVisitor< pass_type >::mutate( WaitForStmt * node ) {
    564         MUTATE_BODY( Statement, node );
    565 }
    566 
    567 //--------------------------------------------------------------------------
    568 // NullStmt
    569 template< typename pass_type >
    570549void PassVisitor< pass_type >::visit( NullStmt * node ) {
    571550        VISIT_BODY( node );
     
    573552
    574553template< typename pass_type >
    575 NullStmt * PassVisitor< pass_type >::mutate( NullStmt * node ) {
    576         MUTATE_BODY( NullStmt, node );
    577 }
    578 
    579 //--------------------------------------------------------------------------
    580 // DeclStmt
    581 template< typename pass_type >
    582554void PassVisitor< pass_type >::visit( DeclStmt * node ) {
    583555        VISIT_BODY( node );
     
    585557
    586558template< typename pass_type >
    587 Statement * PassVisitor< pass_type >::mutate( DeclStmt * node ) {
    588         MUTATE_BODY( Statement, node );
    589 }
    590 
    591 //--------------------------------------------------------------------------
    592 // ImplicitCtorDtorStmt
    593 template< typename pass_type >
    594559void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) {
    595560        VISIT_BODY( node );
     
    597562
    598563template< typename pass_type >
    599 Statement * PassVisitor< pass_type >::mutate( ImplicitCtorDtorStmt * node ) {
    600         MUTATE_BODY( Statement, node );
    601 }
    602 
    603 //--------------------------------------------------------------------------
    604 // ApplicationExpr
    605 template< typename pass_type >
    606564void PassVisitor< pass_type >::visit( ApplicationExpr * node ) {
    607565        VISIT_BODY( node );
    608 }
    609 
    610 template< typename pass_type >
    611 Expression * PassVisitor< pass_type >::mutate( ApplicationExpr * node ) {
    612         MUTATE_BODY( Expression, node );
    613566}
    614567
     
    991944
    992945template< typename pass_type >
     946Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) {
     947        MUTATE_BODY( Statement, node );
     948}
     949
     950template< typename pass_type >
     951NullStmt * PassVisitor< pass_type >::mutate( NullStmt * node ) {
     952        MUTATE_BODY( NullStmt, node );
     953}
     954
     955template< typename pass_type >
     956Statement * PassVisitor< pass_type >::mutate( DeclStmt * node ) {
     957        MUTATE_BODY( Statement, node );
     958}
     959
     960template< typename pass_type >
     961Statement * PassVisitor< pass_type >::mutate( ImplicitCtorDtorStmt * node ) {
     962        MUTATE_BODY( Statement, node );
     963}
     964
     965template< typename pass_type >
     966Expression * PassVisitor< pass_type >::mutate( ApplicationExpr * node ) {
     967        MUTATE_BODY( Expression, node );
     968}
     969
     970template< typename pass_type >
    993971Expression * PassVisitor< pass_type >::mutate( NameExpr * node ) {
    994972        MUTATE_BODY( Expression, node );
  • src/Common/SemanticError.cc

    rfbcb354 r326338ae  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Aug 29 18:17:35 2017
    13 // Update Count     : 3
     12// Last Modified On : Tue May 19 07:21:25 2015
     13// Update Count     : 1
    1414//
    1515
    16 #include <cstdio>                                                                               // for fileno, stderr
    17 #include <unistd.h>                                                                             // for isatty
    18 #include <iostream>                                                                             // for basic_ostream, operator<<, ostream
    19 #include <list>                                                                                 // for list, _List_iterator
    20 #include <string>                                                                               // for string, operator<<, operator+, to_string
     16#include <cstdio>            // for fileno, stderr
     17#include <unistd.h>          // for isatty
     18#include <iostream>          // for basic_ostream, operator<<, ostream
     19#include <list>              // for list, _List_iterator
     20#include <string>            // for string, operator<<, operator+, to_string
    2121
    22 #include "Common/utility.h"                                                             // for to_string, CodeLocation (ptr only)
     22#include "Common/utility.h"  // for to_string, CodeLocation (ptr only)
    2323#include "SemanticError.h"
     24
     25inline const std::string& error_str() {
     26        static std::string str = isatty( fileno(stderr) ) ? "\e[31merror:\e[39m " : "error: ";
     27        return str;
     28}
    2429
    2530SemanticError::SemanticError() {
     
    4449void SemanticError::print( std::ostream &os ) {
    4550        using std::to_string;
    46         for( auto err : errors ) {
    47                 os << to_string( err.location ) << err.description << std::endl;
     51        for(auto err : errors) {
     52                os << to_string( err.location ) << err.description << '\n';
    4853        }
    4954}
  • src/Common/SemanticError.h

    rfbcb354 r326338ae  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Aug 29 22:03:36 2017
    13 // Update Count     : 17
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Aug 17 14:01:00 2017
     13// Update Count     : 7
    1414//
    1515
    1616#pragma once
    1717
    18 #include <exception>                                                                    // for exception
    19 #include <iostream>                                                                             // for ostream
    20 #include <list>                                                                                 // for list
    21 #include <string>                                                                               // for string
    22 #include <unistd.h>                                                                             // for isatty
     18#include <exception>  // for exception
     19#include <iostream>   // for ostream
     20#include <list>       // for list
     21#include <string>     // for string
    2322
    24 #include "CodeLocation.h"                                                               // for CodeLocation, toString
     23#include "CodeLocation.h"  // for CodeLocation, toString
    2524
    2625struct error {
     
    2928
    3029        error() = default;
    31         error( const std::string & str ) : description( str ) {}
     30        error( const std::string& str ) : description( str ) {}
    3231
    33         void maybeSet( const CodeLocation & location ) {
     32        void maybeSet( const CodeLocation& location ) {
    3433                if( this->location.linenumber < 0 ) {
    3534                        this->location = location;
     
    4241        SemanticError();
    4342        SemanticError( std::string error );
    44         template< typename T > SemanticError( const std::string & error, const T * obj );
     43        template< typename T > SemanticError( const std::string &error, const T *obj );
    4544        ~SemanticError() throw() {}
    4645
    47         static inline const std::string & error_str() {
    48                 static std::string str = isatty( STDERR_FILENO ) ? "\e[31merror:\e[39m " : "error: ";
    49                 return str;
    50         }
    51 
    52         void append( SemanticError & other );
     46        void append( SemanticError &other );
    5347        void append( const std::string & );
    5448        bool isEmpty() const;
    55         void print( std::ostream & os );
     49        void print( std::ostream &os );
    5650
    57         void set_location( const CodeLocation & location );
    58         // constructs an exception using the given message and the printed representation of the obj (T must have a print
    59         // method)
     51        void set_location( const CodeLocation& location );
     52        // constructs an exception using the given message and the printed
     53        // representation of the obj (T must have a print method)
    6054  private:
    6155        std::list< error > errors;
     
    6357
    6458template< typename T >
    65 SemanticError::SemanticError( const std::string & error, const T * obj ) {
     59SemanticError::SemanticError( const std::string &error, const T *obj ) {
    6660        append( toString( error, obj ) );
    6761}
  • src/Concurrency/Keywords.cc

    rfbcb354 r326338ae  
    1919#include <string>                  // for string, operator==
    2020
    21 #include "Common/PassVisitor.h"    // for PassVisitor
    2221#include "Common/SemanticError.h"  // for SemanticError
    2322#include "Common/utility.h"        // for deleteAll, map_range
     
    4746
    4847        //=============================================================================================
    49         // Pass declarations
     48        // Visitors declaration
    5049        //=============================================================================================
    5150
     
    5958        //                                           static inline NewField_t * getter_name( MyType * this ) { return &this->newField; }
    6059        //
    61         class ConcurrentSueKeyword : public WithDeclsToAdd {
     60        class ConcurrentSueKeyword : public Visitor {
     61          protected:
     62            template< typename Visitor >
     63            friend void SymTab::acceptAndAdd( std::list< Declaration * > &translationUnit, Visitor &visitor );
    6264          public:
    6365
     
    6769                virtual ~ConcurrentSueKeyword() {}
    6870
    69                 void postvisit( StructDecl * decl );
     71                using Visitor::visit;
     72                virtual void visit( StructDecl * decl ) override final;
    7073
    7174                void handle( StructDecl * );
     
    8386                bool needs_main;
    8487
     88                std::list< Declaration * > declsToAdd, declsToAddAfter;
    8589                StructDecl* type_decl = nullptr;
    8690        };
     
    113117
    114118                static void implement( std::list< Declaration * > & translationUnit ) {
    115                         PassVisitor< ThreadKeyword > impl;
    116                         acceptAll( translationUnit, impl );
     119                        ThreadKeyword impl;
     120                        SymTab::acceptAndAdd( translationUnit, impl );
    117121                }
    118122        };
     
    144148
    145149                static void implement( std::list< Declaration * > & translationUnit ) {
    146                         PassVisitor< CoroutineKeyword > impl;
    147                         acceptAll( translationUnit, impl );
     150                        CoroutineKeyword impl;
     151                        SymTab::acceptAndAdd( translationUnit, impl );
    148152                }
    149153        };
     
    175179
    176180                static void implement( std::list< Declaration * > & translationUnit ) {
    177                         PassVisitor< MonitorKeyword > impl;
    178                         acceptAll( translationUnit, impl );
     181                        MonitorKeyword impl;
     182                        SymTab::acceptAndAdd( translationUnit, impl );
    179183                }
    180184        };
     
    188192        // }                                                               }
    189193        //
    190         class MutexKeyword final {
     194        class MutexKeyword final : public Visitor {
    191195          public:
    192196
    193                 void postvisit( FunctionDecl * decl );
    194                 void postvisit(   StructDecl * decl );
     197                using Visitor::visit;
     198                virtual void visit( FunctionDecl * decl ) override final;
     199                virtual void visit(   StructDecl * decl ) override final;
    195200
    196201                std::list<DeclarationWithType*> findMutexArgs( FunctionDecl* );
     
    199204
    200205                static void implement( std::list< Declaration * > & translationUnit ) {
    201                         PassVisitor< MutexKeyword > impl;
     206                        MutexKeyword impl;
    202207                        acceptAll( translationUnit, impl );
    203208                }
     
    225230        // }                                                               }
    226231        //
    227         class ThreadStarter final {
     232        class ThreadStarter final : public Visitor {
    228233          public:
    229234
    230                 void postvisit( FunctionDecl * decl );
     235                using Visitor::visit;
     236                virtual void visit( FunctionDecl * decl ) override final;
    231237
    232238                void addStartStatement( FunctionDecl * decl, DeclarationWithType * param );
    233239
    234240                static void implement( std::list< Declaration * > & translationUnit ) {
    235                         PassVisitor< ThreadStarter > impl;
     241                        ThreadStarter impl;
    236242                        acceptAll( translationUnit, impl );
    237243                }
     
    258264        // Generic keyword implementation
    259265        //=============================================================================================
    260         void ConcurrentSueKeyword::postvisit(StructDecl * decl) {
     266        void ConcurrentSueKeyword::visit(StructDecl * decl) {
     267                Visitor::visit(decl);
    261268                if( decl->get_name() == type_name && decl->has_body() ) {
    262269                        assert( !type_decl );
     
    346353                }
    347354
    348                 declsToAddBefore.push_back( forward );
    349                 if( needs_main ) declsToAddBefore.push_back( main_decl );
    350                 declsToAddBefore.push_back( get_decl );
     355                declsToAdd.push_back( forward );
     356                if( needs_main ) declsToAdd.push_back( main_decl );
     357                declsToAdd.push_back( get_decl );
    351358
    352359                return get_decl;
     
    398405        //=============================================================================================
    399406
    400         void MutexKeyword::postvisit(FunctionDecl* decl) {
     407        void MutexKeyword::visit(FunctionDecl* decl) {
     408                Visitor::visit(decl);
    401409
    402410                std::list<DeclarationWithType*> mutexArgs = findMutexArgs( decl );
     
    416424        }
    417425
    418         void MutexKeyword::postvisit(StructDecl* decl) {
     426        void MutexKeyword::visit(StructDecl* decl) {
     427                Visitor::visit(decl);
    419428
    420429                if( decl->get_name() == "monitor_desc" ) {
     
    523532        // General entry routine
    524533        //=============================================================================================
    525         void ThreadStarter::postvisit(FunctionDecl * decl) {
     534        void ThreadStarter::visit(FunctionDecl * decl) {
     535                Visitor::visit(decl);
     536
    526537                if( ! CodeGen::isConstructor(decl->get_name()) ) return;
    527538
  • src/InitTweak/InitTweak.cc

    rfbcb354 r326338ae  
    325325                        std::string name = getFunctionName( expr );
    326326                        assertf( name == "*?", "Unexpected untyped expression: %s", name.c_str() );
    327                         assertf( ! expr->get_args().empty(), "Cannot get called function from dereference with no arguments" );
     327                        assertf( ! expr->get_args().empty(), "Can't get called function from dereference with no arguments" );
    328328                        return getCalledFunction( expr->get_args().front() );
    329329                }
     
    433433                        std::string name = getFunctionName( expr );
    434434                        assertf( name == "*?", "Unexpected untyped expression: %s", name.c_str() );
    435                         assertf( ! expr->get_args().empty(), "Cannot get function name from dereference with no arguments" );
     435                        assertf( ! expr->get_args().empty(), "Can't get function name from dereference with no arguments" );
    436436                        return funcName( expr->get_args().front() );
    437437                }
  • src/Parser/StatementNode.cc

    rfbcb354 r326338ae  
    212212        WaitForStmt::Target target;
    213213        target.function = maybeBuild<Expression>( targetExpr );
    214 
    215         ExpressionNode * next = dynamic_cast<ExpressionNode *>( targetExpr->get_next() );
    216         targetExpr->set_next( nullptr );
    217         buildMoveList< Expression >( next, target.arguments );
    218 
     214        buildMoveList< Expression >( targetExpr, target.arguments );
    219215        delete targetExpr;
    220216
     
    230226WaitForStmt * build_waitfor( ExpressionNode * targetExpr, StatementNode * stmt, ExpressionNode * when, WaitForStmt * node ) {
    231227        WaitForStmt::Target target;
     228
    232229        target.function = maybeBuild<Expression>( targetExpr );
    233 
    234         ExpressionNode * next = dynamic_cast<ExpressionNode *>( targetExpr->get_next() );
    235         targetExpr->set_next( nullptr );
    236         buildMoveList< Expression >( next, target.arguments );
    237 
     230        buildMoveList< Expression >( targetExpr, target.arguments );
    238231        delete targetExpr;
    239232
  • src/Parser/lex.ll

    rfbcb354 r326338ae  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Wed Aug 30 17:35:21 2017
    13  * Update Count     : 584
     12 * Last Modified On : Tue Aug 22 22:43:39 2017
     13 * Update Count     : 558
    1414 */
    1515
     
    1919
    2020%{
    21 // The lexer assumes the program has been preprocessed by cpp. Hence, all user level preprocessor directive have been
     21// This lexer assumes the program has been preprocessed by cpp. Hence, all user level preprocessor directive have been
    2222// performed and removed from the source. The only exceptions are preprocessor directives passed to the compiler (e.g.,
    2323// line-number directives) and C/C++ style comments, which are ignored.
     
    2525//**************************** Includes and Defines ****************************
    2626
    27 unsigned int column = 0;                                                                // position of the end of the last token parsed
    28 #define YY_USER_ACTION column += yyleng;                                // trigger before each matching rule's action
    29 
    3027#include <string>
    3128#include <cstdio>                                                                               // FILENAME_MAX
    32 using namespace std;
    3329
    3430#include "ParseNode.h"
     
    3632
    3733char *yyfilename;
    38 string *strtext;                                                                                // accumulate parts of character and string constant value
     34std::string *strtext;                                                                   // accumulate parts of character and string constant value
    3935
    4036#define RETURN_LOCN(x)          yylval.tok.loc.file = yyfilename; yylval.tok.loc.line = yylineno; return( x )
    41 #define RETURN_VAL(x)           yylval.tok.str = new string( yytext ); RETURN_LOCN( x )
     37#define RETURN_VAL(x)           yylval.tok.str = new std::string( yytext ); RETURN_LOCN( x )
    4238#define RETURN_CHAR(x)          yylval.tok.str = nullptr; RETURN_LOCN( x )
    4339#define RETURN_STR(x)           yylval.tok.str = strtext; RETURN_LOCN( x )
    4440
    4541#define WHITE_RETURN(x)         // do nothing
    46 #define NEWLINE_RETURN()        column = 0; WHITE_RETURN( '\n' )
     42#define NEWLINE_RETURN()        WHITE_RETURN( '\n' )
    4743#define ASCIIOP_RETURN()        RETURN_CHAR( (int)yytext[0] ) // single character operator
    4844#define NAMEDOP_RETURN(x)       RETURN_CHAR( x )                        // multichar operator, with a name
     
    158154                memcpy( &filename, begin_string + 1, length );  // copy file name from yytext
    159155                filename[ length ] = '\0';                                              // terminate string with sentinel
    160                 //cout << "file " << filename << " line " << lineno << endl;
     156                //std::cout << "file " << filename << " line " << lineno << std::endl;
    161157                yylineno = lineno;
    162158                yyfilename = filename;
     
    306302
    307303                                /* character constant, allows empty value */
    308 ({cwide_prefix}[_]?)?['] { BEGIN QUOTE; rm_underscore(); strtext = new string( yytext, yyleng ); }
     304({cwide_prefix}[_]?)?['] { BEGIN QUOTE; rm_underscore(); strtext = new std::string( yytext, yyleng ); }
    309305<QUOTE>[^'\\\n]* { strtext->append( yytext, yyleng ); }
    310306<QUOTE>['\n]    { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(CHARACTERconstant); }
     
    312308
    313309                                /* string constant */
    314 ({swide_prefix}[_]?)?["] { BEGIN STRING; rm_underscore(); strtext = new string( yytext, yyleng ); }
     310({swide_prefix}[_]?)?["] { BEGIN STRING; rm_underscore(); strtext = new std::string( yytext, yyleng ); }
    315311<STRING>[^"\\\n]* { strtext->append( yytext, yyleng ); }
    316312<STRING>["\n]   { BEGIN 0; strtext->append( yytext, yyleng ); RETURN_STR(STRINGliteral); }
     
    426422}
    427423
    428                                 /* unknown character */
    429 .                               { yyerror( "unknown character" ); }
     424                                /* unknown characters */
     425.                               { printf("unknown character(s):\"%s\" on line %d\n", yytext, yylineno); }
    430426
    431427%%
    432 // ----end of lexer----
    433 
    434 void yyerror( const char * errmsg ) {
    435         cout << (yyfilename ? yyfilename : "*unknown file*") << ':' << yylineno << ':' << column - yyleng + 1
    436                  << ": " << SemanticError::error_str() << errmsg << " at token \"" << (yytext[0] == '\0' ? "EOF" : yytext) << '"' << endl;
    437 }
    438428
    439429// Local Variables: //
  • src/Parser/parser.yy

    rfbcb354 r326338ae  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug 30 07:04:19 2017
    13 // Update Count     : 2740
     12// Last Modified On : Sat Aug 26 17:50:19 2017
     13// Update Count     : 2712
    1414//
    1515
     
    4848#include <cstdio>
    4949#include <stack>
    50 using namespace std;
    51 
    5250#include "ParseNode.h"
    5351#include "TypedefTable.h"
    5452#include "TypeData.h"
    5553#include "LinkageSpec.h"
    56 #include "Common/SemanticError.h"                                               // error_str
     54using namespace std;
    5755
    5856extern DeclarationNode * parseTree;
     
    31353133// ----end of grammar----
    31363134
     3135extern char *yytext;
     3136
     3137void yyerror( const char * ) {
     3138        cout << "Error ";
     3139        if ( yyfilename ) {
     3140                cout << "in file " << yyfilename << " ";
     3141        } // if
     3142        cout << "at line " << yylineno << " reading token \"" << (yytext[0] == '\0' ? "EOF" : yytext) << "\"" << endl;
     3143}
     3144
    31373145// Local Variables: //
    31383146// mode: c++ //
  • src/ResolvExpr/AlternativeFinder.cc

    rfbcb354 r326338ae  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sat May 16 23:52:08 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Aug 28 13:47:24 2017
    13 // Update Count     : 32
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jul 26 11:33:00 2017
     13// Update Count     : 31
    1414//
    1515
     
    195195                                AltList winners;
    196196                                findMinCost( alternatives.begin(), alternatives.end(), back_inserter( winners ) );
    197                                 stream << "Cannot choose between " << winners.size() << " alternatives for expression ";
     197                                stream << "Can't choose between " << winners.size() << " alternatives for expression ";
    198198                                expr->print( stream );
    199199                                stream << "Alternatives are:";
  • src/SymTab/Validate.cc

    rfbcb354 r326338ae  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 21:50:04 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Aug 28 13:47:23 2017
    13 // Update Count     : 359
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Tus Aug  8 13:27:00 2017
     13// Update Count     : 358
    1414//
    1515
     
    709709                } else {
    710710                        TypeDeclMap::const_iterator base = typedeclNames.find( typeInst->get_name() );
    711                         assertf( base != typedeclNames.end(), "Cannot find typedecl name %s", typeInst->get_name().c_str() );
     711                        assertf( base != typedeclNames.end(), "Can't find typedecl name %s", typeInst->get_name().c_str() );
    712712                        typeInst->set_baseType( base->second );
    713713                } // if
  • src/libcfa/concurrency/coroutine

    rfbcb354 r326338ae  
     1//                              - *- Mode: CFA - *-
    12//
    23// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
     
    1011// Created On       : Mon Nov 28 12:27:26 2016
    1112// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug 30 07:58:29 2017
    13 // Update Count     : 3
     13// Last Modified On : Sat Jul 22 09:57:17 2017
     14// Update Count     : 2
    1415//
    1516
  • src/prelude/prelude.cf

    rfbcb354 r326338ae  
     1//                               -*- Mode: C -*-
    12//
    23// Copyright (C) Glen Ditchfield 1994, 1999
     
    78// Created On       : Sat Nov 29 07:23:41 2014
    89// Last Modified By : Peter A. Buhr
    9 // Last Modified On : Wed Aug 30 07:56:07 2017
    10 // Update Count     : 93
     10// Last Modified On : Tue Jul  5 18:04:40 2016
     11// Update Count     : 92
    1112//
    1213
  • src/tests/.expect/castError.txt

    rfbcb354 r326338ae  
    1 castError.c:7:1 error: Cannot choose between 3 alternatives for expression Cast of:
     1castError.c:7 error: Can't choose between 3 alternatives for expression Cast of:
    22  Name: f
    33
  • src/tests/.expect/completeTypeError.txt

    rfbcb354 r326338ae  
    1 completeTypeError.c:34:1 error: No reasonable alternatives for expression Applying untyped:
     1completeTypeError.c:34 error: No reasonable alternatives for expression Applying untyped:
    22  Name: *?
    33...to:
     
    55
    66
    7 completeTypeError.c:36:1 error: No reasonable alternatives for expression Applying untyped:
     7completeTypeError.c:36 error: No reasonable alternatives for expression Applying untyped:
    88  Name: baz
    99...to:
     
    1111
    1212
    13 completeTypeError.c:37:1 error: No reasonable alternatives for expression Applying untyped:
     13completeTypeError.c:37 error: No reasonable alternatives for expression Applying untyped:
    1414  Name: quux
    1515...to:
     
    1717
    1818
    19 completeTypeError.c:58:1 error: No reasonable alternatives for expression Applying untyped:
     19completeTypeError.c:58 error: No reasonable alternatives for expression Applying untyped:
    2020  Name: baz
    2121...to:
     
    2323
    2424
    25 completeTypeError.c:59:1 error: No reasonable alternatives for expression Applying untyped:
     25completeTypeError.c:59 error: No reasonable alternatives for expression Applying untyped:
    2626  Name: quux
    2727...to:
     
    2929
    3030
    31 completeTypeError.c:60:1 error: No reasonable alternatives for expression Applying untyped:
     31completeTypeError.c:60 error: No reasonable alternatives for expression Applying untyped:
    3232  Name: *?
    3333...to:
     
    3535
    3636
    37 completeTypeError.c:72:1 error: No reasonable alternatives for expression Applying untyped:
     37completeTypeError.c:72 error: No reasonable alternatives for expression Applying untyped:
    3838  Name: baz
    3939...to:
  • src/tests/.expect/declarationErrors.txt

    rfbcb354 r326338ae  
    1 declarationErrors.c:16:1 error: duplicate static in declaration of x1: static const volatile short int
     1declarationErrors.c:16 error: duplicate static in declaration of x1: static const volatile short int
    22
    3 declarationErrors.c:17:1 error: conflicting extern & static in declaration of x2: extern const volatile short int
     3declarationErrors.c:17 error: conflicting extern & static in declaration of x2: extern const volatile short int
    44
    5 declarationErrors.c:18:1 error: conflicting extern & auto, conflicting extern & static, conflicting extern & static, duplicate extern in declaration of x3: extern const volatile short int
     5declarationErrors.c:18 error: conflicting extern & auto, conflicting extern & static, conflicting extern & static, duplicate extern in declaration of x3: extern const volatile short int
    66
    7 declarationErrors.c:19:1 error: duplicate static in declaration of x4: static const volatile instance of const volatile struct __anonymous0
     7declarationErrors.c:19 error: duplicate static in declaration of x4: static const volatile instance of const volatile struct __anonymous0
    88  with members
    99   with body
    1010
    1111
    12 declarationErrors.c:20:1 error: duplicate const, duplicate static, duplicate volatile in declaration of x5: static const volatile instance of const volatile struct __anonymous1
     12declarationErrors.c:20 error: duplicate const, duplicate static, duplicate volatile in declaration of x5: static const volatile instance of const volatile struct __anonymous1
    1313  with members
    1414   with body
    1515
    1616
    17 declarationErrors.c:22:1 error: duplicate static in declaration of x6: static const volatile instance of type Int
     17declarationErrors.c:22 error: duplicate static in declaration of x6: static const volatile instance of type Int
    1818
    19 declarationErrors.c:24:1 error: duplicate const in declaration of f01: static inline function
     19declarationErrors.c:24 error: duplicate const in declaration of f01: static inline function
    2020  with no parameters
    2121  returning const volatile int
    2222
    2323
    24 declarationErrors.c:25:1 error: duplicate volatile in declaration of f02: static inline function
     24declarationErrors.c:25 error: duplicate volatile in declaration of f02: static inline function
    2525  with no parameters
    2626  returning const volatile int
    2727
    2828
    29 declarationErrors.c:26:1 error: duplicate const in declaration of f03: static inline function
     29declarationErrors.c:26 error: duplicate const in declaration of f03: static inline function
    3030  with no parameters
    3131  returning const volatile int
    3232
    3333
    34 declarationErrors.c:27:1 error: duplicate volatile in declaration of f04: static inline function
     34declarationErrors.c:27 error: duplicate volatile in declaration of f04: static inline function
    3535  with no parameters
    3636  returning const volatile int
    3737
    3838
    39 declarationErrors.c:28:1 error: duplicate const in declaration of f05: static inline function
     39declarationErrors.c:28 error: duplicate const in declaration of f05: static inline function
    4040  with no parameters
    4141  returning const volatile int
    4242
    4343
    44 declarationErrors.c:29:1 error: duplicate volatile in declaration of f06: static inline function
     44declarationErrors.c:29 error: duplicate volatile in declaration of f06: static inline function
    4545  with no parameters
    4646  returning const volatile int
    4747
    4848
    49 declarationErrors.c:30:1 error: duplicate const in declaration of f07: static inline function
     49declarationErrors.c:30 error: duplicate const in declaration of f07: static inline function
    5050  with no parameters
    5151  returning const volatile int
    5252
    5353
    54 declarationErrors.c:31:1 error: duplicate const, duplicate volatile in declaration of f08: static inline function
     54declarationErrors.c:31 error: duplicate const, duplicate volatile in declaration of f08: static inline function
    5555  with no parameters
    5656  returning const volatile int
    5757
    5858
    59 declarationErrors.c:33:1 error: duplicate const, duplicate volatile in declaration of f09: static inline function
     59declarationErrors.c:33 error: duplicate const, duplicate volatile in declaration of f09: static inline function
    6060  with no parameters
    6161  returning const volatile int
    6262
    6363
    64 declarationErrors.c:34:1 error: duplicate const, duplicate _Atomic, duplicate _Atomic, duplicate const, duplicate restrict, duplicate volatile in declaration of f09: static inline function
     64declarationErrors.c:34 error: duplicate const, duplicate _Atomic, duplicate _Atomic, duplicate const, duplicate restrict, duplicate volatile in declaration of f09: static inline function
    6565  with no parameters
    6666  returning const restrict volatile _Atomic int
  • src/tests/.expect/dtor-early-exit-ERR1.txt

    rfbcb354 r326338ae  
    1 dtor-early-exit.c:142:1 error: jump to label 'L1' crosses initialization of y Branch (Goto)
    2 
     1dtor-early-exit.c:142 error: jump to label 'L1' crosses initialization of y Branch (Goto)
  • src/tests/.expect/dtor-early-exit-ERR2.txt

    rfbcb354 r326338ae  
    1 dtor-early-exit.c:142:1 error: jump to label 'L2' crosses initialization of y Branch (Goto)
    2 
     1dtor-early-exit.c:142 error: jump to label 'L2' crosses initialization of y Branch (Goto)
  • src/tests/.expect/memberCtors-ERR1.txt

    rfbcb354 r326338ae  
    1 memberCtors.c:71:1 error: in void ?{}(B &b), field a2 used before being constructed
     1memberCtors.c:71 error: in void ?{}(B &b), field a2 used before being constructed
  • src/tests/.expect/scopeErrors.txt

    rfbcb354 r326338ae  
    1 scopeErrors.c:2:1 error: duplicate object definition for thisIsAnError: signed int
    2 scopeErrors.c:20:1 error: duplicate function definition for butThisIsAnError: function
     1scopeErrors.c:2 error: duplicate object definition for thisIsAnError: signed int
     2scopeErrors.c:20 error: duplicate function definition for butThisIsAnError: function
    33  with parameters
    44    double
    5   returning 
     5  returning
    66    _retval_butThisIsAnError:       Attribute with name: unused
    77double
    8   with body 
     8  with body
    99    CompoundStmt
    10 
  • src/tests/div.c

    rfbcb354 r326338ae  
     1//                               -*- Mode: C -*-
    12//
    23// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
     
    1011// Created On       : Tue Aug  8 16:28:43 2017
    1112// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug 30 07:56:28 2017
    13 // Update Count     : 17
     13// Last Modified On : Wed Aug  9 17:09:40 2017
     14// Update Count     : 16
    1415//
    1516
  • src/tests/ifcond.c

    rfbcb354 r326338ae  
     1//                               -*- Mode: C -*-
    12//
    2 // Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
     3// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
    34//
    45// The contents of this file are covered under the licence agreement in the
     
    1011// Created On       : Sat Aug 26 10:13:11 2017
    1112// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug 30 07:55:24 2017
    13 // Update Count     : 13
     13// Last Modified On : Sat Aug 26 11:13:00 2017
     14// Update Count     : 11
    1415//
    1516
  • tools/prettyprinter/lex.ll

    rfbcb354 r326338ae  
    77 * lex.ll --
    88 *
    9  * Author           : Peter A. Buhr
     9 * Author           : Rodolfo Gabriel Esteves
    1010 * Created On       : Sat Dec 15 11:45:59 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Tue Aug 29 17:33:36 2017
    13  * Update Count     : 268
     12 * Last Modified On : Fri Jul 21 23:06:16 2017
     13 * Update Count     : 254
    1414 */
    1515
    1616%option stack
    1717%option yylineno
    18 %option nounput
    1918
    2019%{
     
    3130string comment_str;
    3231string code_str;
    33 
    34 // Stop warning due to incorrectly generated flex code.
    35 #pragma GCC diagnostic ignored "-Wsign-compare"
    3632%}
    3733
     
    4844/* ---------------------------- Token Section ---------------------------- */
    4945%%
    50 <INITIAL,C_CODE>"/*" {                                                                  // C style comments */
    51 #if defined(DEBUG_ALL) | defined(DEBUG_COMMENT)
    52     cerr << "\"/*\" : " << yytext << endl;
    53 #endif
    54     if ( YYSTATE == C_CODE ) code_str += yytext;
    55     else comment_str += yytext;
    56     yy_push_state(C_COMMENT);
    57 }
    58 <C_COMMENT>(.|"\n")     {                                                                       // C style comments
    59 #if defined(DEBUG_ALL) | defined(DEBUG_COMMENT)
    60     cerr << "<C_COMMENT>(.|\\n) : " << yytext << endl;
    61 #endif
    62     if ( yy_top_state() == C_CODE ) code_str += yytext;
    63     else comment_str += yytext;
    64 }
    65 <C_COMMENT>"*/" {                                                                               // C style comments
    66 #if defined(DEBUG_ALL) | defined(DEBUG_COMMENT)
    67         cerr << "<C_COMMENT>\"*/\" : " << yytext << endl;
    68 #endif
    69         if ( yy_top_state() == C_CODE ) code_str += yytext;
    70         else {
    71                 comment_str += yytext;
    72                 //cerr << "C COMMENT : " << endl << comment_str << endl;
    73                 ws_list.push_back( comment_str );
    74                 comment_str = "";
    75         }
    76         yy_pop_state();
    77 }
     46<INITIAL,C_CODE>"/*"    {                               /* C style comments */
     47                        #if defined(DEBUG_ALL) | defined(DEBUG_COMMENT)
     48                            cerr << "\"/*\" : " << yytext << endl;
     49                        #endif
     50                            if ( YYSTATE == C_CODE ) code_str += yytext;
     51                            else comment_str += yytext;
     52                            yy_push_state(C_COMMENT);
     53                        }
     54<C_COMMENT>(.|"\n")     {                               /* C style comments */
     55                        #if defined(DEBUG_ALL) | defined(DEBUG_COMMENT)
     56                            cerr << "<C_COMMENT>(.|\\n) : " << yytext << endl;
     57                        #endif
     58                            if ( yy_top_state() == C_CODE ) code_str += yytext;
     59                            else comment_str += yytext;
     60                        }
     61<C_COMMENT>"*/"         {                               /* C style comments */
     62                        #if defined(DEBUG_ALL) | defined(DEBUG_COMMENT)
     63                            cerr << "<C_COMMENT>\"*/\" : " << yytext << endl;
     64                        #endif
     65                            if ( yy_top_state() == C_CODE ) code_str += yytext;
     66                            else {
     67                                comment_str += yytext;
     68                                //cerr << "C COMMENT : " << endl << comment_str << endl;
     69                                ws_list.push_back( comment_str );
     70                                comment_str = "";
     71                            }
     72                            yy_pop_state();
     73                        }
     74<INITIAL,C_CODE>"//"[^\n]*"\n" {                        /* C++ style comments */
     75                        #if defined(DEBUG_ALL) | defined(DEBUG_COMMENT)
     76                            cerr << "\"//\"[^\\n]*\"\n\" : " << yytext << endl;
     77                        #endif
     78                            if ( YYSTATE == C_CODE ) code_str += yytext;
     79                            else {
     80                                comment_str += yytext;
     81                                //cerr << "C++ COMMENT : " << endl << comment_str << endl;
     82                                ws_list.push_back( comment_str );
     83                                comment_str = "";
     84                            }
     85                        }
    7886
    79 <INITIAL,C_CODE>"//"[^\n]*"\n" {                                                // C++ style comments
    80 #if defined(DEBUG_ALL) | defined(DEBUG_COMMENT)
    81         cerr << "\"//\"[^\\n]*\"\n\" : " << yytext << endl;
    82 #endif
    83         if ( YYSTATE == C_CODE ) code_str += yytext;
    84         else {
    85                 comment_str += yytext;
    86                 //cerr << "C++ COMMENT : " << endl << comment_str << endl;
    87                 ws_list.push_back( comment_str );
    88                 comment_str = "";
    89         }
    90 }
     87";"                     { RETURN_TOKEN( ';' ) }
     88":"                     { RETURN_TOKEN( ':' ) }
     89"|"                     { RETURN_TOKEN( '|' ) }
     90","                     { RETURN_TOKEN( ',' ) }
     91"<"                     { RETURN_TOKEN( '<' ) }
     92">"                     { RETURN_TOKEN( '>' ) }
    9193
    92 ";"                             { RETURN_TOKEN( ';' ) }
    93 ":"                             { RETURN_TOKEN( ':' ) }
    94 "|"                             { RETURN_TOKEN( '|' ) }
    95 ","                             { RETURN_TOKEN( ',' ) }
    96 "<"                             { RETURN_TOKEN( '<' ) }
    97 ">"                             { RETURN_TOKEN( '>' ) }
     94[[:space:]]+            {                               /* [ \t\n]+ */
     95                            ws_list.push_back( yytext );
     96                            //cerr << "WS : " << "\"" << yytext << "\"" << endl;
     97                        }
    9898
    99 [[:space:]]+ {                                                                                  // [ \t\n]+
    100         ws_list.push_back( yytext );
    101         //cerr << "WS : " << "\"" << yytext << "\"" << endl;
    102 }
    103 
    104 <INITIAL>"{"    { RETURN_TOKEN( '{' ) }
    105 <INITIAL>"}"    { RETURN_TOKEN( '}' ) }
    106 <C_CODE>"{"     {
    107 #if defined(DEBUG_ALL) | defined(DEBUG_C)
    108         cerr << "<C_CODE>. : " << yytext << endl;
    109 #endif
    110         code_str += yytext;
    111         RETURN_TOKEN( '{' )
    112 }
    113 <C_CODE>"}"     {
    114 #if defined(DEBUG_ALL) | defined(DEBUG_C)
    115         cerr << "<C_CODE>. : " << yytext << endl;
    116 #endif
    117         code_str += yytext;
    118         RETURN_TOKEN( '}' )
    119 }
     99<INITIAL>"{"            { RETURN_TOKEN( '{' ) }
     100<INITIAL>"}"            { RETURN_TOKEN( '}' ) }
     101<C_CODE>"{"             {
     102                        #if defined(DEBUG_ALL) | defined(DEBUG_C)
     103                            cerr << "<C_CODE>. : " << yytext << endl;
     104                        #endif
     105                            code_str += yytext;
     106                            RETURN_TOKEN( '{' )
     107                        }
     108<C_CODE>"}"             {
     109                        #if defined(DEBUG_ALL) | defined(DEBUG_C)
     110                            cerr << "<C_CODE>. : " << yytext << endl;
     111                        #endif
     112                            code_str += yytext;
     113                            RETURN_TOKEN( '}' )
     114                        }
    120115
    121116"%%"                    { RETURN_TOKEN( MARK ) }
    122117"%{"                    { RETURN_TOKEN( LCURL ) }
    123 <C_CODE>"%}"    { RETURN_TOKEN( RCURL ) }
     118<C_CODE>"%}"            { RETURN_TOKEN( RCURL ) }
    124119
    125 ^"%union"       { RETURN_TOKEN( UNION ) }
    126 ^"%start"       { RETURN_TOKEN( START ) }
    127 ^"%token"       { RETURN_TOKEN( TOKEN ) }
    128 ^"%type"            { RETURN_TOKEN( TYPE ) }
    129 ^"%left"            { RETURN_TOKEN( LEFT ) }
    130 ^"%right"           { RETURN_TOKEN( RIGHT ) }
    131 ^"%nonassoc"    { RETURN_TOKEN( NONASSOC ) }
    132 ^"%precedence"  { RETURN_TOKEN( PRECEDENCE ) }
    133 ^"%pure_parser" { RETURN_TOKEN( PURE_PARSER ) }
    134 ^"%semantic_parser"     { RETURN_TOKEN( SEMANTIC_PARSER ) }
    135 ^"%expect"      { RETURN_TOKEN( EXPECT ) }
     120^"%union"               { RETURN_TOKEN( UNION ) }
     121^"%start"               { RETURN_TOKEN( START ) }
     122^"%token"               { RETURN_TOKEN( TOKEN ) }
     123^"%type"                { RETURN_TOKEN( TYPE ) }
     124^"%left"                { RETURN_TOKEN( LEFT ) }
     125^"%right"               { RETURN_TOKEN( RIGHT ) }
     126^"%nonassoc"            { RETURN_TOKEN( NONASSOC ) }
     127^"%pure_parser"         { RETURN_TOKEN( PURE_PARSER ) }
     128^"%semantic_parser"     { RETURN_TOKEN( SEMANTIC_PARSER ) }
     129^"%expect"              { RETURN_TOKEN( EXPECT ) }
    136130^"%thong"               { RETURN_TOKEN( THONG ) }
    137131
    138132"%prec"                 { RETURN_TOKEN( PREC ) }
    139133
    140 {integer}           { RETURN_TOKEN( INTEGER ); }
    141 [']{c_char}[']  { RETURN_TOKEN( CHARACTER ); }
    142 {identifier}    { RETURN_TOKEN( IDENTIFIER ); }
     134{integer}               { RETURN_TOKEN( INTEGER ); }
     135[']{c_char}[']          { RETURN_TOKEN( CHARACTER ); }
     136{identifier}            { RETURN_TOKEN( IDENTIFIER ); }
    143137
    144 <C_CODE>["]{s_char}*["] {                                                               // hide braces "{}" in strings
    145 #if defined(DEBUG_ALL) | defined(DEBUG_C)
    146         cerr << "<C_CODE>. : " << yytext << endl;
    147 #endif
    148         code_str += yytext;
    149 }
     138<C_CODE>["]{s_char}*["] {                               /* hide braces "{}" in strings */
     139                        #if defined(DEBUG_ALL) | defined(DEBUG_C)
     140                            cerr << "<C_CODE>. : " << yytext << endl;
     141                        #endif
     142                            code_str += yytext;
     143                        }
    150144
    151 <C_CODE>(.|\n) {                                                                                // must be last rule of C_CODE
    152 #if defined(DEBUG_ALL) | defined(DEBUG_C)
    153         cerr << "<C_CODE>. : " << yytext << endl;
    154 #endif
    155         code_str += yytext;
    156 }
     145<C_CODE>(.|\n)          {                               /* must be last rule of C_CODE */
     146                        #if defined(DEBUG_ALL) | defined(DEBUG_C)
     147                            cerr << "<C_CODE>. : " << yytext << endl;
     148                        #endif
     149                            code_str += yytext;
     150                        }
    157151
    158                                 /* unknown characters */
    159 .                               { printf("unknown character(s):\"%s\" on line %d\n", yytext, yylineno); }
     152.                       { printf("UNKNOWN CHARACTER:%s\n", yytext); } /* unknown characters */
    160153%%
    161154void lexC(void) {
  • tools/prettyprinter/parser.hh

    rfbcb354 r326338ae  
    5959    RIGHT = 269,
    6060    NONASSOC = 270,
    61     PRECEDENCE = 271,
    62     TYPE = 272,
    63     PURE_PARSER = 273,
    64     SEMANTIC_PARSER = 274,
    65     EXPECT = 275,
    66     THONG = 276,
    67     PREC = 277,
    68     END_TERMINALS = 278,
    69     _SECTIONS = 279,
    70     _DEFSECTION_OPT = 280,
    71     _LITERALBLOCK = 281,
    72     _DECLARATION = 282,
    73     _TAG_OPT = 283,
    74     _NAMENOLIST = 284,
    75     _NAMENO = 285,
    76     _NAMELIST = 286,
    77     _RULESECTION = 287,
    78     _RULE = 288,
    79     _LHS = 289,
    80     _RHS = 290,
    81     _PREC = 291,
    82     _ACTION = 292,
    83     _USERSECTION_OPT = 293
     61    TYPE = 271,
     62    PURE_PARSER = 272,
     63    SEMANTIC_PARSER = 273,
     64    EXPECT = 274,
     65    THONG = 275,
     66    PREC = 276,
     67    END_TERMINALS = 277,
     68    _SECTIONS = 278,
     69    _DEFSECTION_OPT = 279,
     70    _LITERALBLOCK = 280,
     71    _DECLARATION = 281,
     72    _TAG_OPT = 282,
     73    _NAMENOLIST = 283,
     74    _NAMENO = 284,
     75    _NAMELIST = 285,
     76    _RULESECTION = 286,
     77    _RULE = 287,
     78    _LHS = 288,
     79    _RHS = 289,
     80    _PREC = 290,
     81    _ACTION = 291,
     82    _USERSECTION_OPT = 292
    8483  };
    8584#endif
     
    9897#define RIGHT 269
    9998#define NONASSOC 270
    100 #define PRECEDENCE 271
    101 #define TYPE 272
    102 #define PURE_PARSER 273
    103 #define SEMANTIC_PARSER 274
    104 #define EXPECT 275
    105 #define THONG 276
    106 #define PREC 277
    107 #define END_TERMINALS 278
    108 #define _SECTIONS 279
    109 #define _DEFSECTION_OPT 280
    110 #define _LITERALBLOCK 281
    111 #define _DECLARATION 282
    112 #define _TAG_OPT 283
    113 #define _NAMENOLIST 284
    114 #define _NAMENO 285
    115 #define _NAMELIST 286
    116 #define _RULESECTION 287
    117 #define _RULE 288
    118 #define _LHS 289
    119 #define _RHS 290
    120 #define _PREC 291
    121 #define _ACTION 292
    122 #define _USERSECTION_OPT 293
     99#define TYPE 271
     100#define PURE_PARSER 272
     101#define SEMANTIC_PARSER 273
     102#define EXPECT 274
     103#define THONG 275
     104#define PREC 276
     105#define END_TERMINALS 277
     106#define _SECTIONS 278
     107#define _DEFSECTION_OPT 279
     108#define _LITERALBLOCK 280
     109#define _DECLARATION 281
     110#define _TAG_OPT 282
     111#define _NAMENOLIST 283
     112#define _NAMENO 284
     113#define _NAMELIST 285
     114#define _RULESECTION 286
     115#define _RULE 287
     116#define _LHS 288
     117#define _RHS 289
     118#define _PREC 290
     119#define _ACTION 291
     120#define _USERSECTION_OPT 292
    123121
    124122/* Value type.  */
     
    131129        Token *tokenp;
    132130
    133 #line 134 "parser.hh" /* yacc.c:1909  */
     131#line 132 "parser.hh" /* yacc.c:1909  */
    134132};
    135133
  • tools/prettyprinter/parser.yy

    rfbcb354 r326338ae  
    1010// Created On       : Sat Dec 15 13:44:21 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Aug 29 16:34:10 2017
    13 // Update Count     : 1047
     12// Last Modified On : Thu Jun 29 09:26:47 2017
     13// Update Count     : 1045
    1414//
    1515
     
    6767%token<tokenp>  RIGHT                                                                   // %right
    6868%token<tokenp>  NONASSOC                                                                // %nonassoc
    69 %token<tokenp>  PRECEDENCE                                                              // %precedence
    7069%token<tokenp>  TYPE                                                                    // %type
    7170%token<tokenp>  PURE_PARSER                                                             // %pure_parser
     
    260259        | RIGHT
    261260        | NONASSOC
    262         | PRECEDENCE
    263261        ;
    264262
Note: See TracChangeset for help on using the changeset viewer.