|
|
/*------------------------------------------------------------------------------
|
|
|
-- 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>
|
|
|
#include <QStack>
|
|
|
#include "vhdl_ast_node.h"
|
|
|
#include "vhdl_fragment.h"
|
|
|
|
|
|
#undef YY_DECL
|
|
|
#define YY_DECL int VHDL_Tools::vhdl_Scanner::yylex()
|
|
|
|
|
|
namespace VHDL_Tools{
|
|
|
|
|
|
class vhdl_Scanner_block_stack
|
|
|
{
|
|
|
public:
|
|
|
vhdl_Scanner_block_stack(bool waitForSemicolon,bool waitForParen, int delta)
|
|
|
:waitForSemicolon(waitForSemicolon),waitForParen(waitForParen),stackDelta(delta){}
|
|
|
bool waitForSemicolon;
|
|
|
bool waitForParen;
|
|
|
int stackDelta;
|
|
|
};
|
|
|
|
|
|
class vhdl_Scanner : public yyFlexLexer
|
|
|
{
|
|
|
public:
|
|
|
vhdl_Scanner(std::istream *in,const QString& fileName);
|
|
|
~vhdl_Scanner();
|
|
|
int scan();
|
|
|
int newFile(std::istream *in, const QString& fileName, bool trashPreviousTree=false);
|
|
|
VHDL_Tools::VHDL_AST_Node* getScanTree(){return rootNode;}
|
|
|
private:
|
|
|
/* hide this one from public view */
|
|
|
int yylex();
|
|
|
void appendNode(VHDL_Tools::VHDL_AST_Node* node);
|
|
|
void deleteNode(VHDL_Tools::VHDL_AST_Node* node);
|
|
|
VHDL_Tools::VHDL_AST_Node* rootNode,*currentNode;
|
|
|
};
|
|
|
}
|
|
|
|
|
|
#endif // vhdl_SCANNER_H
|
|
|
|