|
7 | 7 | * This module contains functions for generating tags for VHDL files. |
8 | 8 | * |
9 | 9 | * References: |
| 10 | +* https://rti.etf.bg.ac.rs/rti/ri5rvl/tutorial/TUTORIAL/IEEE/HTML/1076_TOC.HTM |
| 11 | +* https://tams.informatik.uni-hamburg.de/vhdl/tools/grammar/vhdl93-bnf.html |
10 | 12 | * http://www.vhdl.renerta.com/mobile/index.html |
11 | 13 | * https://www.hdlworks.com/hdl_corner/vhdl_ref/ |
12 | 14 | * https://www.ics.uci.edu/~jmoorkan/vhdlref/Synario%20VHDL%20Manual.pdf |
@@ -348,9 +350,8 @@ static bool isIdentifierMatch (const tokenInfo * const token, |
348 | 350 | const char *name) |
349 | 351 | { |
350 | 352 | return (bool) (isType (token, TOKEN_IDENTIFIER) && |
351 | | - strcasecmp (vStringValue (token->string), name) == 0); |
352 | | - /* XXX this is copy/paste from eiffel.c and slightly modified */ |
353 | | - /* shouldn't we use strNcasecmp ? */ |
| 353 | + strncasecmp (vStringValue (token->string), name, |
| 354 | + vStringLength (token->string)) == 0); |
354 | 355 | } |
355 | 356 |
|
356 | 357 | static bool isSemicolonOrKeywordOrIdent (const tokenInfo * const token, |
@@ -589,16 +590,18 @@ static void parseTillEnd (tokenInfo * const token, int parent, const int end_key |
589 | 590 | { |
590 | 591 | bool ended = false; |
591 | 592 | tagEntryInfo *e = getEntryInCorkQueue (parent); |
592 | | - const char *end_id = e->name; |
| 593 | + /* If e is NULL, the input may be broken as VHDL code |
| 594 | + * or unsupported syntax in this parser. */ |
593 | 595 |
|
594 | 596 | do |
595 | 597 | { |
596 | 598 | readToken (token); |
597 | 599 | if (isKeyword (token, KEYWORD_END)) |
598 | 600 | { |
599 | 601 | readToken (token); |
600 | | - ended = isSemicolonOrKeywordOrIdent (token, |
601 | | - end_keyword, end_id); |
| 602 | + if (e) |
| 603 | + ended = isSemicolonOrKeywordOrIdent (token, |
| 604 | + end_keyword, e->name); |
602 | 605 | if (!isType (token, TOKEN_SEMICOLON)) |
603 | 606 | skipToCharacterInInputFile (';'); |
604 | 607 | if (ended) |
|
0 commit comments