vhdl_scanner.h
67 lines
| 2.3 KiB
| text/x-c
|
CLexer
r0 | /*------------------------------------------------------------------------------ | |||
-- This file is a part of the VHDL Tools Software | ||||
-- Copyright (C) 2014, Plasma Physics Laboratory - CNRS | ||||
-- | ||||
-- This program is free software; you can redistribute it and/or modify | ||||
-- it under the terms of the GNU General Public License as published by | ||||
-- the Free Software Foundation; either version 2 of the License, or | ||||
-- (at your option) any later version. | ||||
-- | ||||
-- This program is distributed in the hope that it will be useful, | ||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
-- GNU General Public License for more details. | ||||
-- | ||||
-- You should have received a copy of the GNU General Public License | ||||
-- along with this program; if not, write to the Free Software | ||||
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||
-------------------------------------------------------------------------------*/ | ||||
/*-- Author : Alexis Jeandet | ||||
-- Mail : alexis.jeandet@member.fsf.org | ||||
----------------------------------------------------------------------------*/ | ||||
#ifndef vhdl_SCANNER_H | ||||
#define vhdl_SCANNER_H | ||||
#if ! defined(yyFlexLexerOnce) | ||||
#include <FlexLexer.h> | ||||
#endif | ||||
#include <iostream> | ||||
#include <cstdlib> | ||||
#include <fstream> | ||||
#include <QString> | ||||
#include <QList> | ||||
r1 | #include <QStack> | |||
#include "vhdl_ast_node.h" | ||||
r0 | #undef YY_DECL | |||
#define YY_DECL int VHDL_Tools::vhdl_Scanner::yylex() | ||||
namespace VHDL_Tools{ | ||||
r1 | class vhdl_Scanner_block_stack | |||
r0 | { | |||
public: | ||||
r1 | vhdl_Scanner_block_stack(bool waitForSemicolon,bool waitForParen, int delta) | |||
:waitForSemicolon(waitForSemicolon),waitForParen(waitForParen),stackDelta(delta){} | ||||
bool waitForSemicolon; | ||||
bool waitForParen; | ||||
int stackDelta; | ||||
r0 | }; | |||
class vhdl_Scanner : public yyFlexLexer | ||||
{ | ||||
public: | ||||
r1 | vhdl_Scanner(std::istream *in,const QString& fileName); | |||
~vhdl_Scanner(); | ||||
r0 | int scan(); | |||
r1 | int newFile(std::istream *in, const QString& fileName, bool trashPreviousTree=false); | |||
VHDL_Tools::VHDL_AST_Node* getScanTree(){return rootNode;} | ||||
r0 | private: | |||
/* hide this one from public view */ | ||||
int yylex(); | ||||
r2 | /* handle locations */ | |||
int yycolumn; | ||||
r0 | void appendNode(VHDL_Tools::VHDL_AST_Node* node); | |||
r1 | VHDL_Tools::VHDL_AST_Node* rootNode,*currentNode; | |||
r0 | }; | |||
} | ||||
#endif // vhdl_SCANNER_H | ||||