%{
#include <stdio.h>
#include <string.h>
#include "attr_type.h"
#include "token_type.h"
#include "vhdlparser.tab.h"
/* VHDLソースの行番号 */
int Source_Position=1;
%}
A [aA]
B [bB]
C [cC]
D [dD]
E [eE]
F [fF]
G [gG]
H [hH]
I [iI]
J [jJ]
K [kK]
L [lL]
M [mM]
N [nN]
O [oO]
P [pP]
Q [qQ]
R [rR]
S [sS]
T [tT]
U [uU]
V [vV]
W [wW]
X [xX]
Y [yY]
Z [zZ]
upper_case_letter [A-Z]
lower_case_letter [a-z]
digit [0-9]
special_character [/#/&/'/(/)/*/+/,/-/.///:/;/</=/>/_/|]
space_character [ /t]
format_effector [/t/v/r/l/f]
end_of_line /n
other_special_character [/!/$/@/?/[///]/^/`/{/}/~]
kanji_character [/x80-/xFE].
graphic_character ({basic_graphic_character}|{lower_case_letter}|{other_special_character})
basic_graphic_character ({upper_case_letter}|{digit}|{special_character}|{space_character}|{kanji_character})
letter ({upper_case_letter}|{lower_case_letter})
letter_or_digit ({letter}|{digit})
letter_or_digit_kanji ({letter}|{digit}|{kanji_character})
decimal_literal {integer}(/.{integer})?({exponent})?
integer {digit}(_?{digit})*
exponent ([eE][-+]?{integer})
base {integer}
based_integer {extended_digit}(_?{extended_digit})*
extended_digit ({digit}|[a-fA-F])
base_specifier (B|b|O|o|X|x)
%%
{A}{B}{S} {
yylval.TsrcPos = Source_Position;
return KW_ABS;
}
{A}{C}{C}{E}{S}{S} {
yylval.TsrcPos = Source_Position;
return KW_ACCESS;
}
{A}{F}{T}{E}{R} {
yylval.TsrcPos = Source_Position;
return KW_AFTER;
}
{A}{L}{I}{A}{S} {
yylval.TsrcPos = Source_Position;
return KW_ALIAS;
}
{A}{L}{L} {
yylval.TsrcPos = Source_Position;
return KW_ALL;
}
{A}{N}{D} {
yylval.TsrcPos = Source_Position;
return KW_AND;
}
{A}{R}{C}{H}{I}{T}{E}{C}{T}{U}{R}{E} {
yylval.TsrcPos = Source_Position;
return KW_ARCHITECTURE;
}
{A}{R}{R}{A}{Y} {
yylval.TsrcPos = Source_Position;
return KW_ARRAY;
}
{A}{S}{S}{E}{R}{T} {
yylval.TsrcPos = Source_Position;
return KW_ASSERT;
}
{A}{T}{T}{R}{I}{B}{U}{T}{E} {
yylval.TsrcPos = Source_Position;
return KW_ATTRIBUTE;
}
{B}{E}{G}{I}{N} {
yylval.TsrcPos = Source_Position;
return KW_BEGIN;
}
{B}{L}{O}{C}{K} {
yylval.TsrcPos = Source_Position;
return KW_BLOCK;
}
{B}{O}{D}{Y} {
yylval.TsrcPos = Source_Position;
return KW_BODY;
}
{B}{U}{F}{F}{E}{R} {
yylval.TsrcPos = Source_Position;
return KW_BUFFER;
}
{B}{U}{S} {
yylval.TsrcPos = Source_Position;
return KW_BUS;
}
{C}{A}{S}{E} {
yylval.TsrcPos = Source_Position;
return KW_CASE;
}
{C}{O}{M}{P}{O}{N}{E}{N}{T} {
yylval.TsrcPos = Source_Position;
return KW_COMPONENT;
}
{C}{O}{N}{F}{I}{G}{U}{R}{A}{T}{I}{O}{N} {
yylval.TsrcPos = Source_Position;
return KW_CONFIGURATION;
}
{C}{O}{N}{S}{T}{A}{N}{T} {
yylval.TsrcPos = Source_Position;
return KW_CONSTANT;
}
{C}{O}{N}{S}{T}{R}{A}{I}{N}{T} {
yylval.TsrcPos = Source_Position;
return KW_CONSTRAINT;
}
{D}{I}{S}{C}{O}{N}{N}{E}{C}{T} {
yylval.TsrcPos = Source_Position;
return KW_DISCONNECT;
}
{D}{O}{W}{N}{T}{O} {
yylval.TsrcPos = Source_Position;
return KW_DOWNTO;
}
{E}{L}{S}{E} {
yylval.TsrcPos = Source_Position;
return KW_ELSE;
}
{E}{L}{S}{I}{F} {
yylval.TsrcPos = Source_Position;
return KW_ELSIF;
}
{E}{N}{D} {
yylval.TsrcPos = Source_Position;
return KW_END;
}
{E}{N}{T}{I}{T}{Y} {
yylval.TsrcPos = Source_Position;
return KW_ENTITY;
}
{E}{X}{I}{T} {
yylval.TsrcPos = Source_Position;
return KW_EXIT;
}
{F}{I}{L}{E} {
yylval.TsrcPos = Source_Position;
return KW_FILE;
}
{F}{O}{R} {
yylval.TsrcPos = Source_Position;
return KW_FOR;
}
{F}{U}{N}{C}{T}{I}{O}{N} {
yylval.TsrcPos = Source_Position;
return KW_FUNCTION;
}
{G}{E}{N}{E}{R}{A}{T}{E} {
yylval.TsrcPos = Source_Position;
return KW_GENERATE;
}
{G}{E}{N}{E}{R}{I}{C} {
yylval.TsrcPos = Source_Position;
return KW_GENERIC;
}
{G}{U}{A}{R}{D}{E}{D} {
yylval.TsrcPos = Source_Position;
return KW_GUARDED;
}
{G}{R}{O}{U}{P} {
yylval.TsrcPos = Source_Position;
return KW_GROUP;
}
{I}{F} {
yylval.TsrcPos = Source_Position;
return KW_IF;
}
{I}{N} {
yylval.TsrcPos = Source_Position;
return KW_IN;
}
{I}{N}{E}{R}{T}{I}{A}{L} {
yylval.TsrcPos = Source_Position;
return KW_INERTIAL;
}
{I}{N}{O}{U}{T} {
yylval.TsrcPos = Source_Position;
return KW_INOUT;
}
{I}{N}{P}{U}{R}{E} {
yylval.TsrcPos = Source_Position;
return KW_INPURE;
}
{P}{U}{R}{E} {
yylval.TsrcPos = Source_Position;
return KW_PURE;
}
{I}{S} {
yylval.TsrcPos = Source_Position;
return KW_IS;
}
{L}{A}{B}{E}{L} {
yylval.TsrcPos = Source_Position;
return KW_LABEL;
}
{L}{I}{B}{R}{A}{R}{Y} {
yylval.TsrcPos = Source_Position;
return KW_LIBRARY;
}
{L}{I}{N}{K}{A}{G}{E} {
yylval.TsrcPos = Source_Position;
return KW_LINKAGE;
}
{L}{O}{O}{P} {
yylval.TsrcPos = Source_Position;
return KW_LOOP;
}
{M}{A}{P} {
yylval.TsrcPos = Source_Position;
return KW_MAP;
}
{M}{O}{D} {
yylval.TsrcPos = Source_Position;
return KW_MOD;
}
{N}{A}{N}{D} {
yylval.TsrcPos = Source_Position;
return NAND_OP;
}
{N}{E}{W} {
yylval.TsrcPos = Source_Position;
return KW_NEW;
}
{N}{E}{X}{T} {
yylval.TsrcPos = Source_Position;
return KW_NEXT;
}
{N}{O}{R} {
yylval.TsrcPos = Source_Position;
return NOR_OP;
}
{X}{N}{O}{R} {
yylval.TsrcPos = Source_Position;
return XNOR_OP;
}
{N}{O}{T} {
yylval.TsrcPos = Source_Position;
return KW_NOT;
}
{N}{U}{L}{L} {
yylval.TsrcPos = Source_Position;
return KW_NULL;
}
{O}{F} {
yylval.TsrcPos = Source_Position;
return KW_OF;
}
{O}{N} {
yylval.TsrcPos = Source_Position;
return KW_ON;
}
{O}{P}{E}{N} {
yylval.TsrcPos = Source_Position;
return KW_OPEN;
}
{O}{R} {
yylval.TsrcPos = Source_Position;
return OR_OP;
}
{O}{T}{H}{E}{R}{S} {
yylval.TsrcPos = Source_Position;
return KW_OTHERS;
}
{O}{U}{T} {
yylval.TsrcPos = Source_Position;
return KW_OUT;
}
{P}{A}{C}{K}{A}{G}{E} {
yylval.TsrcPos = Source_Position;
return KW_PACKAGE;
}
{P}{O}{R}{T} {
yylval.TsrcPos = Source_Position;
return KW_PORT;
}
{P}{O}{S}{T}{P}{O}{N}{E}{D} {
yylval.TsrcPos = Source_Position;
return KW_POSTPONED;
}
{P}{R}{O}{C}{E}{D}{U}{R}{E} {
yylval.TsrcPos = Source_Position;
return KW_PROCEDURE;
}
{P}{R}{O}{C}{E}{S}{S} {
yylval.TsrcPos = Source_Position;
return KW_PROCESS;
}
{R}{A}{N}{G}{E} {
yylval.TsrcPos = Source_Position;
return KW_RANGE;
}
{R}{E}{C}{O}{R}{D} {
yylval.TsrcPos = Source_Position;
return KW_RECORD;
}
{R}{E}{G}{I}{S}{T}{E}{R} {
yylval.TsrcPos = Source_Position;
return KW_REGISTER;
}
{R}{E}{J}{E}{C}{T} {
yylval.TsrcPos = Source_Position;
return KW_REJECT;
}
{R}{E}{M} {
yylval.TsrcPos = Source_Position;
return KW_REM;
}
{R}{E}{P}{O}{R}{T} {
yylval.TsrcPos = Source_Position;
return KW_REPORT;
}
{R}{E}{T}{U}{R}{N} {
yylval.TsrcPos = Source_Position;
return KW_RETURN;
}
{R}{O}{L} {
yylval.TsrcPos = Source_Position;
return KW_ROL;
}
{R}{O}{R} {
yylval.TsrcPos = Source_Position;
return KW_ROR;
}
{S}{E}{L}{E}{C}{T} {
yylval.TsrcPos = Source_Position;
return KW_SELECT;
}
{S}{E}{V}{E}{R}{I}{T}{Y} {
yylval.TsrcPos = Source_Position;
return KW_SEVERITY;
}
{S}{H}{A}{R}{E}{D} {
yylval.TsrcPos = Source_Position;
return KW_SHARED;
}
{S}{I}{G}{N}{A}{L} {
yylval.TsrcPos = Source_Position;
return KW_SIGNAL;
}
{S}{R}{A} {
yylval.TsrcPos = Source_Position;
return KW_SRA;
}
{S}{L}{A} {
yylval.TsrcPos = Source_Position;
return KW_SLA;
}
{S}{R}{L} {
yylval.TsrcPos = Source_Position;
return KW_SRL;
}
{S}{L}{L} {
yylval.TsrcPos = Source_Position;
return KW_SLL;
}
{S}{U}{B}{T}{Y}{P}{E} {
yylval.TsrcPos = Source_Position;
return KW_SUBTYPE;
}
{T}{H}{E}{N} {
yylval.TsrcPos = Source_Position;
return KW_THEN;
}
{T}{O} {
yylval.TsrcPos = Source_Position;
return KW_TO;
}
{T}{R}{A}{N}{S}{P}{O}{R}{T} {
yylval.TsrcPos = Source_Position;
return KW_TRANSPORT;
}
{T}{Y}{P}{E} {
yylval.TsrcPos = Source_Position;
return KW_TYPE;
}
{U}{N}{A}{F}{F}{E}{C}{T}{E}{D} {
yylval.TsrcPos = Source_Position;
return KW_UNAFFECTED;
}
{U}{N}{I}{T}{S} {
yylval.TsrcPos = Source_Position;
return KW_UNITS;
}
{U}{N}{T}{I}{L} {
yylval.TsrcPos = Source_Position;
return KW_UNTIL;
}
{U}{S}{E} {
yylval.TsrcPos = Source_Position;
return KW_USE;
}
{V}{A}{R}{I}{A}{B}{L}{E} {
yylval.TsrcPos = Source_Position;
return KW_VARIABLE;
}
{W}{A}{I}{T} {
yylval.TsrcPos = Source_Position;
return KW_WAIT;
}
{W}{H}{E}{N} {
yylval.TsrcPos = Source_Position;
return KW_WHEN;
}
{W}{H}{I}{L}{E} {
yylval.TsrcPos = Source_Position;
return KW_WHILE;
}
{W}{I}{T}{H} {
yylval.TsrcPos = Source_Position;
return KW_WITH;
}
{X}{O}{R} {
yylval.TsrcPos = Source_Position;
return XOR_OP;
}
"&" {
yylval.TsrcPos = Source_Position;
return AND_OP;
}
"'" {
yylval.TsrcPos = Source_Position;
return APST_OP;
}
"(" {
yylval.TsrcPos = Source_Position;
return L_PAR;
}
")" {
yylval.TsrcPos = Source_Position;
return R_PAR;
}
"{" {
yylval.TsrcPos = Source_Position;
return L_BRACE;
}
"}" {
yylval.TsrcPos = Source_Position;
return R_BRACE;
}
"**" {
yylval.TsrcPos = Source_Position;
return DAST_OP;
}
"*" {
yylval.TsrcPos = Source_Position;
return AST_OP;
}
"+" {
yylval.TsrcPos = Source_Position;
return PLUS_OP;
}
"," {
yylval.TsrcPos = Source_Position;
return COMMA;
}
"-" {
yylval.TsrcPos = Source_Position;
return MINUS_OP;
}
":=" {
yylval.TsrcPos = Source_Position;
return ASGN_OP;
}
":" {
yylval.TsrcPos = Source_Position;
return COLON;
}
";" {
yylval.TsrcPos = Source_Position;
return SCOLON;
}
"<=" {
yylval.TsrcPos = Source_Position;
return LE_OP;
}
">=" {
yylval.TsrcPos = Source_Position;
return GE_OP;
}
"<" {
yylval.TsrcPos = Source_Position;
return LT_OP;
}
">" {
yylval.TsrcPos = Source_Position;
return GT_OP;
}
"=" {
yylval.TsrcPos = Source_Position;
return EQ_OP;
}
"/=" {
yylval.TsrcPos = Source_Position;
return NE_OP;
}
"=>" {
yylval.TsrcPos = Source_Position;
return ARROW_OP;
}
"<>" {
yylval.TsrcPos = Source_Position;
return BOX_OP;
}
"|" {
yylval.TsrcPos = Source_Position;
return BAR_OP;
}
"!" {
yylval.TsrcPos = Source_Position;
return NOT_OP;
}
"." {
yylval.TsrcPos = Source_Position;
return DOT_OP;
}
"/" {
yylval.TsrcPos = Source_Position;
return SLASH_OP;
}
{letter}(_?{letter_or_digit_kanji})* {
yylval.Tid.pos = Source_Position;
/*
strcpy(yylval.Tid.img, yytext);
extern symtab *func_table;
extern symtab *proc_table;
extern symtab *type_table;
if(search(func_table, yytext)){
#ifdef DEBUG
printf("%s is function_name/n", yytext);
#endif
return FUNCTION_NAME;
}else if(search(proc_table, yytext)){
#ifdef DEBUG
printf("%s is procedure_name/n", yytext);
#endif
return PROCEDURE_NAME;
}else if(search(type_table, yytext)){
#ifdef DEBUG
printf("%s is type_name/n", yytext);
#endif
return TYPE_NAME;
}
*/
return ID;
}
({decimal_literal})|({base}#{based_integer}(/.{based_integer})?#({exponent})?)|({base}:{based_integer}(/.{based_integer})?:({exponent})?) {
yylval.TsrcPos = Source_Position;
return ABSTRACT_LITERAL;
}
'({graphic_character}|/"|/%)' {
yylval.TsrcPos = Source_Position;
return CHARACTER;
}
(/"({graphic_character}|(/"/")|/%)*/")|(/%({graphic_character}|(/%/%)|/")*/%) {
yylval.TsrcPos = Source_Position;
return STRING;
}
{base_specifier}(/"{extended_digit}(_?{extended_digit})*/"|/%{extended_digit}(_?{extended_digit})*/%) {
yylval.TsrcPos = Source_Position;
return BIT_STRING_LITERAL;
}
{extended_digit}(_?{extended_digit})* {
yylval.TsrcPos = Source_Position;
return BIT_VALUE;
}
/n { Source_Position++; }
/-/-.*$ ;
{space_character} ;
. ;
%%
/************************************************************
* 修正履歴:
*
*************************************************************/
/*int yywrap(){
return 1;
}*/