Changeset f980549 for src/Parser


Ignore:
Timestamp:
Sep 20, 2017, 12:24:45 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
b18830e
Parents:
764e009 (diff), 47b5b63 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src/Parser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ParseNode.h

    r764e009 rf980549  
    4444//##############################################################################
    4545
     46typedef CodeLocation YYLTYPE;
     47#define YYLTYPE_IS_DECLARED 1 /* alert the parser that we have our own definition */
     48
    4649extern char * yyfilename;
    4750extern int yylineno;
     51extern YYLTYPE yylloc;
    4852
    4953class ParseNode {
     
    7377        ParseNode * next = nullptr;
    7478        std::string * name = nullptr;
    75         CodeLocation location = { yyfilename, yylineno };
     79        CodeLocation location = yylloc;
    7680}; // ParseNode
    7781
  • src/Parser/lex.ll

    r764e009 rf980549  
    2626
    2727unsigned 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
     28#define YY_USER_ACTION yylloc.first_line = yylineno; yylloc.first_column = column; column += yyleng; yylloc.last_column = column; yylloc.last_line = yylineno; yylloc.filename = yyfilename ? yyfilename : "";                          // trigger before each matching rule's action
    2929
    3030#include <string>
  • src/Parser/parser.yy

    r764e009 rf980549  
    116116
    117117bool forall = false;                                                                    // aggregate have one or more forall qualifiers ?
     118
     119# define YYLLOC_DEFAULT(Cur, Rhs, N)                            \
     120do                                                              \
     121        if (N) {                                                      \
     122                (Cur).first_line   = YYRHSLOC(Rhs, 1).first_line;           \
     123                (Cur).first_column = YYRHSLOC(Rhs, 1).first_column;         \
     124                (Cur).last_line    = YYRHSLOC(Rhs, N).last_line;            \
     125                (Cur).last_column  = YYRHSLOC(Rhs, N).last_column;          \
     126                (Cur).filename     = YYRHSLOC(Rhs, 1).filename;             \
     127        } else {                                                      \
     128                (Cur).first_line   = (Cur).last_line   =                    \
     129                        YYRHSLOC(Rhs, 0).last_line;                               \
     130                (Cur).first_column = (Cur).last_column =                    \
     131                        YYRHSLOC(Rhs, 0).last_column;                             \
     132                (Cur).filename     = YYRHSLOC(Rhs, 0).filename;             \
     133        }                                                             \
     134while (0)
    118135%}
    119136
     
    346363%precedence ELSE        // token precedence for start of else clause in IF/WAITFOR statement
    347364
     365%locations
    348366
    349367%start translation_unit                                                                 // parse-tree root
Note: See TracChangeset for help on using the changeset viewer.