]> granicus.if.org Git - re2c/commitdiff
'token.h' no longer depends on 'file_info'.
authorUlya Trofimovich <skvadrik@gmail.com>
Thu, 26 Feb 2015 12:37:07 +0000 (12:37 +0000)
committerUlya Trofimovich <skvadrik@gmail.com>
Thu, 26 Feb 2015 12:37:07 +0000 (12:37 +0000)
Part of campaign to remove 'stream_lc.h'.

re2c/bootstrap/parser.cc
re2c/parser.y
re2c/token.h

index 2a7be60135d9893e0ed9dc1395927b6b0511850c..7e61a5c6f8b7900300dc59e043a867da25d152f9 100644 (file)
@@ -157,7 +157,7 @@ void context_rule(CondList *clist, RegExp *expr, RegExp *look, Str *newcond, Tok
        for(CondList::const_iterator it = clist->begin(); it != clist->end(); ++it)
        {
                //Str *condcpy = newcond ? new Str(*newcond) : newcond;
-               Token *token = new Token(code, sourceFileInfo, newcond);//condcpy);
+               Token *token = new Token(code, sourceFileInfo.fname, sourceFileInfo.ln->get_line (), newcond);//condcpy);
                RuleOp *rule = new RuleOp(expr, look, token, accept++, ins_access);
 
                RegExpMap::iterator itRE = specMap.find(*it);
@@ -1723,7 +1723,7 @@ yyreduce:
     {
                        assert((yyvsp[(7) - (7)].str));
                        context_check(NULL);
-                       Token *token = new Token(NULL, sourceFileInfo, (yyvsp[(7) - (7)].str));
+                       Token *token = new Token(NULL, sourceFileInfo.fname, sourceFileInfo.ln->get_line (), (yyvsp[(7) - (7)].str));
                        delete (yyvsp[(7) - (7)].str);
                        specStar.push_back(new RuleOp((yyvsp[(4) - (7)].regexp), (yyvsp[(5) - (7)].regexp), token, accept++, RegExp::PRIVATE));
                }
@@ -1779,7 +1779,7 @@ yyreduce:
                        {
                                in->fatal("code to handle illegal condition already defined");
                        }
-                       Token *token = new Token(NULL, sourceFileInfo, (yyvsp[(3) - (3)].str));
+                       Token *token = new Token(NULL, sourceFileInfo.fname, sourceFileInfo.ln->get_line (), (yyvsp[(3) - (3)].str));
                        delete (yyvsp[(3) - (3)].str);
                        (yyval.regexp) = specNone = new RuleOp(new NullOp(), new NullOp(), token, accept++, RegExp::SHARED);
                }
index 530785a2bee2bad73e8194953c9008ad6bcbc382..6b8752b5a5bcc3f49c316a5a457e7d0f00271db7 100644 (file)
@@ -89,7 +89,7 @@ void context_rule(CondList *clist, RegExp *expr, RegExp *look, Str *newcond, Tok
        for(CondList::const_iterator it = clist->begin(); it != clist->end(); ++it)
        {
                //Str *condcpy = newcond ? new Str(*newcond) : newcond;
-               Token *token = new Token(code, sourceFileInfo, newcond);//condcpy);
+               Token *token = new Token(code, sourceFileInfo.fname, sourceFileInfo.ln->get_line (), newcond);//condcpy);
                RuleOp *rule = new RuleOp(expr, look, token, accept++, ins_access);
 
                RegExpMap::iterator itRE = specMap.find(*it);
@@ -281,7 +281,7 @@ rule:
                {
                        assert($7);
                        context_check(NULL);
-                       Token *token = new Token(NULL, sourceFileInfo, $7);
+                       Token *token = new Token(NULL, sourceFileInfo.fname, sourceFileInfo.ln->get_line (), $7);
                        delete $7;
                        specStar.push_back(new RuleOp($4, $5, token, accept++, RegExp::PRIVATE));
                }
@@ -322,7 +322,7 @@ rule:
                        {
                                in->fatal("code to handle illegal condition already defined");
                        }
-                       Token *token = new Token(NULL, sourceFileInfo, $3);
+                       Token *token = new Token(NULL, sourceFileInfo.fname, sourceFileInfo.ln->get_line (), $3);
                        delete $3;
                        $$ = specNone = new RuleOp(new NullOp(), new NullOp(), token, accept++, RegExp::SHARED);
                }
index 9ef5b258c0b0652b7c222d9c522f0a497bf34092..c7410797361a1f7bca0744fa206b9e8f7692079f 100644 (file)
@@ -3,7 +3,6 @@
 #define        _token_h
 
 #include "substr.h"
-#include "stream_lc.h"
 
 namespace re2c
 {
@@ -18,24 +17,12 @@ public:
        const bool         autogen;
 
 public:
-       Token(const SubStr&, const file_info&);
        Token(const SubStr&, const std::string&, uint);
-       Token(const Token*, const file_info&, const Str*);
        Token(const Token*, const std::string&, uint, const Str*);
        Token(const Token& oth);
        ~Token();
 };
 
-inline Token::Token(const SubStr& t, const file_info& fi)
-       : text(t)
-       , newcond()
-       , source(fi.fname)
-       , line(fi.ln->get_line())
-       , autogen(false)
-{
-       ;
-}
-
 inline Token::Token(const SubStr& t, const std::string& s, uint l)
        : text(t)
        , newcond()
@@ -46,21 +33,11 @@ inline Token::Token(const SubStr& t, const std::string& s, uint l)
        ;
 }
 
-inline Token::Token(const Token* t, const file_info& fi, const Str *c)
-       : text(t ? t->text.to_string().c_str() : "")
-       , newcond(c ? c->to_string() : "")
-       , source(t ? t->source : fi.fname)
-       , line(t ? t->line : fi.ln->get_line())
-       , autogen(t == NULL)
-{
-       ;
-}
-
 inline Token::Token(const Token* t, const std::string& s, uint l, const Str *c)
        : text(t ? t->text.to_string().c_str() : "")
        , newcond(c ? c->to_string() : "")
-       , source(s)
-       , line(l)
+       , source(t ? t->source : s)
+       , line(t ? t->line : l)
        , autogen(t == NULL)
 {
        ;