Skip to content

Commit

Permalink
Update to require JavaCC 7.0.6 or higher
Browse files Browse the repository at this point in the history
  • Loading branch information
doxygen committed Apr 9, 2022
1 parent 1e1e65b commit bb352ce
Show file tree
Hide file tree
Showing 15 changed files with 2,079 additions and 1,886 deletions.
24 changes: 4 additions & 20 deletions vhdlparser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,13 @@

find_package(Javacc)
if (JAVACC_FOUND)
if (JAVACC_VERSION VERSION_LESS 7.0.5)
message(STATUS " Doxygen requires at least JavaCC version 7.0.5 (installed: ${JAVACC_VERSION})")
if (JAVACC_VERSION VERSION_LESS 7.0.6)
message(STATUS " Doxygen requires at least JavaCC version 7.0.6 (installed: ${JAVACC_VERSION})")
message(STATUS " Fall back to JavaCC not installed, using existing files.")
else()
if (JAVACC_VERSION VERSION_LESS 7.0.6)
add_custom_command(OUTPUT ${GENERATED_SRC}/vhdlparser.jj
COMMAND ${CMAKE_COMMAND} -E remove ${PROJECT_SOURCE_DIR}/vhdlparser/Token.h
COMMAND ${CMAKE_COMMAND} -E remove ${PROJECT_SOURCE_DIR}/vhdlparser/Token.cc
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/vhdlparser/vhdlparser.jj ${GENERATED_SRC}/vhdlparser.jj
DEPENDS ${PROJECT_SOURCE_DIR}/vhdlparser/vhdlparser.jj
)
else()
add_custom_command(
COMMAND ${CMAKE_COMMAND} -E remove ${PROJECT_SOURCE_DIR}/vhdlparser/Token.h
COMMAND ${CMAKE_COMMAND} -E remove ${PROJECT_SOURCE_DIR}/vhdlparser/Token.cc
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/vhdlparser/vhdljj_adj.py ${PROJECT_SOURCE_DIR}/vhdlparser/vhdlparser.jj ${GENERATED_SRC}/vhdlparser.jj
DEPENDS ${PROJECT_SOURCE_DIR}/vhdlparser/vhdlparser.jj ${PROJECT_SOURCE_DIR}/vhdlparser/vhdljj_adj.py
OUTPUT ${GENERATED_SRC}/vhdlparser.jj
)
endif()
add_custom_command(
COMMAND ${JAVACC_EXECUTABLE} ${JAVACC_FLAGS} -OUTPUT_DIRECTORY=${PROJECT_SOURCE_DIR}/vhdlparser ${GENERATED_SRC}/vhdlparser.jj
DEPENDS ${GENERATED_SRC}/vhdlparser.jj
COMMAND ${JAVACC_EXECUTABLE} ${JAVACC_FLAGS} -OUTPUT_DIRECTORY=${PROJECT_SOURCE_DIR}/vhdlparser ${PROJECT_SOURCE_DIR}/vhdlparser/vhdlparser.jj
DEPENDS ${PROJECT_SOURCE_DIR}/vhdlparser/vhdlparser.jj
OUTPUT ${PROJECT_SOURCE_DIR}/vhdlparser/CharStream.cc ${PROJECT_SOURCE_DIR}/vhdlparser/CharStream.h ${PROJECT_SOURCE_DIR}/vhdlparser/ErrorHandler.h ${PROJECT_SOURCE_DIR}/vhdlparser/ParseException.cc ${PROJECT_SOURCE_DIR}/vhdlparser/ParseException.h ${PROJECT_SOURCE_DIR}/vhdlparser/Token.cc ${PROJECT_SOURCE_DIR}/vhdlparser/Token.h ${PROJECT_SOURCE_DIR}/vhdlparser/TokenManager.h ${PROJECT_SOURCE_DIR}/vhdlparser/TokenMgrError.cc ${PROJECT_SOURCE_DIR}/vhdlparser/TokenMgrError.h ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParser.cc ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParser.h ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParserConstants.h ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.cc ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.h
)
endif()
Expand Down
4 changes: 2 additions & 2 deletions vhdlparser/CharStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class CharStream {
* Backs up the input stream by amount steps. Lexer calls this method if it
* had already read some characters, but could not use them to match a
* (longer) token. So, they will be used again as the prefix of the next
* token and it is the implemetation's responsibility to do this right.
* token and it is the implementation's responsibility to do this right.
*/
virtual inline void backup(int amount) {
inBuf += amount;
Expand Down Expand Up @@ -268,4 +268,4 @@ class CharStream {
}

#endif
/* JavaCC - OriginalChecksum=c5b4b2e72393f865547f405cc9def169 (do not edit this line) */
/* JavaCC - OriginalChecksum=bad90284b44db6b5391a68c8a6a7b893 (do not edit this line) */
4 changes: 2 additions & 2 deletions vhdlparser/ErrorHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ JJSimpleString addUnicodeEscapes(const JJString& str);
// Called when the parser cannot continue parsing.
// last - the last token successfully parsed.
// unexpected - the token at which the error occurs.
// production - the production in which this error occurrs.
// production - the production in which this error occurs.
virtual void handleParseError(Token *last, Token *unexpected, const JJSimpleString& production, VhdlParser *parser) {
error_count++;
fprintf(stderr, "Encountered: %s at: %d:%d while parsing: %s\n", addUnicodeEscapes(unexpected->image).c_str(), unexpected->beginLine, unexpected->beginColumn, production.c_str());
Expand Down Expand Up @@ -78,4 +78,4 @@ JJSimpleString addUnicodeEscapes(const JJString& str);

#endif

/* JavaCC - OriginalChecksum=5361b31ac6530c6c23511012deb15394 (do not edit this line) */
/* JavaCC - OriginalChecksum=606dd7f8d67c1d0f99424d91ac3656c0 (do not edit this line) */
8 changes: 4 additions & 4 deletions vhdlparser/ParseException.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace parser {
/**
* This is the last token that has been consumed successfully. If
* this object has been created due to a parse error, the token
* followng this token will (therefore) be the first error token.
* following this token will (therefore) be the first error token.
*/
Token currentToken;

Expand All @@ -62,14 +62,14 @@ namespace parser {
* of integers represents a sequence of tokens (by their ordinal
* values) that is expected at this point of the parse.
*/
int** expectedTokenSequences;
int** expectedTokenSequences = 0;

/**
* This is a reference to the "tokenImage" array of the generated
* parser within which the parse error occurred. This array is
* defined in the generated ...Constants class.
*/
JJString* tokenImage;
JJString* tokenImage = 0;

/**
* It uses "currentToken" and "expectedTokenSequences" to generate a parse
Expand Down Expand Up @@ -181,4 +181,4 @@ namespace parser {

}
}
/* JavaCC - OriginalChecksum=7a72405661a136830ccf7f3cab0fffdc (do not edit this line) */
/* JavaCC - OriginalChecksum=bb2d200bbdb84c3b7aff4c7f96769833 (do not edit this line) */
8 changes: 4 additions & 4 deletions vhdlparser/ParseException.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ParseException {
/**
* This is the last token that has been consumed successfully. If
* this object has been created due to a parse error, the token
* followng this token will (therefore) be the first error token.
* following this token will (therefore) be the first error token.
*/
Token currentToken;

Expand All @@ -60,14 +60,14 @@ class ParseException {
* of integers represents a sequence of tokens (by their ordinal
* values) that is expected at this point of the parse.
*/
int** expectedTokenSequences;
int** expectedTokenSequences = 0;

/**
* This is a reference to the "tokenImage" array of the generated
* parser within which the parse error occurred. This array is
* defined in the generated ...Constants class.
*/
JJString* tokenImage;
JJString* tokenImage = 0;

/**
* It uses "currentToken" and "expectedTokenSequences" to generate a parse
Expand Down Expand Up @@ -98,4 +98,4 @@ class ParseException {
}

#endif
/* JavaCC - OriginalChecksum=6705523c0ea4e83f3c38da57253c0aea (do not edit this line) */
/* JavaCC - OriginalChecksum=15877456661be7c62e39a97606c3e899 (do not edit this line) */
4 changes: 2 additions & 2 deletions vhdlparser/Token.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Generated By:JavaCC: Do not edit this line. Token.cc Version 7.0 */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true,TOKEN_INCLUDES=,TOKEN_EXTENDS= */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true,TOKEN_INCLUDE=,TOKEN_SUPER_CLASS=null */
#include "Token.h"

namespace vhdl {
Expand Down Expand Up @@ -96,4 +96,4 @@ namespace parser {

}
}
/* JavaCC - OriginalChecksum=01131f3b3906a670aa8fee6224233701 (do not edit this line) */
/* JavaCC - OriginalChecksum=eec3c6b21c8327ed635f08354be227d8 (do not edit this line) */
18 changes: 9 additions & 9 deletions vhdlparser/Token.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Generated By:JavaCC: Do not edit this line. Token.h Version 7.0 */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true,TOKEN_INCLUDES=,TOKEN_EXTENDS= */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true,TOKEN_INCLUDE=,TOKEN_SUPER_CLASS=null */
#ifndef JAVACC_TOKEN_H
#define JAVACC_TOKEN_H

Expand All @@ -22,16 +22,16 @@ class Token
* system is determined by JavaCCParser, and a table of these numbers is
* stored in the file ...Constants.java.
*/
int kind;
int kind = 0;

/** The line number of the first character of this Token. */
int beginLine;
int beginLine = 0;
/** The column number of the first character of this Token. */
int beginColumn;
int beginColumn = 0;
/** The line number of the last character of this Token. */
int endLine;
int endLine = 0;
/** The column number of the last character of this Token. */
int endColumn;
int endColumn = 0;

/**
* The string image of the token.
Expand All @@ -46,7 +46,7 @@ class Token
* token. Otherwise, see below for a description of the contents of
* this field.
*/
Token *next;
Token *next = 0;

/**
* This field is used to access special tokens that occur prior to this
Expand All @@ -60,7 +60,7 @@ class Token
* immediately follow it (without an intervening regular token). If there
* is no such token, this field is NULL.
*/
Token *specialToken;
Token *specialToken = 0;

/**
* An optional attribute value of the Token.
Expand Down Expand Up @@ -116,4 +116,4 @@ class Token
}

#endif
/* JavaCC - OriginalChecksum=8c237423e3d9695c3bfcf539bcf92375 (do not edit this line) */
/* JavaCC - OriginalChecksum=9655bc4f00696eb7da69bb6a412e2c51 (do not edit this line) */
6 changes: 3 additions & 3 deletions vhdlparser/TokenManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ namespace parser {

class TokenManager {
public:
virtual ~TokenManager() { }
/** This gets the next token from the input stream.
* A token of kind 0 (<EOF>) should be returned on EOF.
* A token of kind 0 (`<EOF>`) should be returned on EOF.
*/
virtual ~TokenManager() { }
virtual Token *getNextToken() = 0;
virtual void setParser(void* parser) {};
virtual void lexicalError() {
Expand All @@ -33,4 +33,4 @@ class TokenManager {
}

#endif
/* JavaCC - OriginalChecksum=c5e389e7ee25f48da34e517ae429ac2a (do not edit this line) */
/* JavaCC - OriginalChecksum=ca665ddedf5f5b0cb69e76d90eb70fe0 (do not edit this line) */
4 changes: 2 additions & 2 deletions vhdlparser/TokenMgrError.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace parser {
// i < 16 - guaranteed
char hexChar(int i) {
if (i < 10) {
return i - '0';
return i + '0';
}
return 'a' + (i - 10);
}
Expand Down Expand Up @@ -115,4 +115,4 @@ JJSimpleString addUnicodeEscapes(const JJString& str) {

}
}
/* JavaCC - OriginalChecksum=ed66d80b94c73435ce2644e44f7b4d49 (do not edit this line) */
/* JavaCC - OriginalChecksum=a1a009b68896ee1d7f7d1528d80d284b (do not edit this line) */
4 changes: 2 additions & 2 deletions vhdlparser/TokenMgrError.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class TokenMgrError {
* Indicates the reason why the exception is thrown. It will have
* one of the above 4 values.
*/
int errorCode;
int errorCode = -1;

/**
* Returns a detailed message for the Error when it is thrown by the
Expand Down Expand Up @@ -90,4 +90,4 @@ class TokenMgrError {
}

#endif
/* JavaCC - OriginalChecksum=4ab4cdcdef6a3feec22fd9c00ba86e07 (do not edit this line) */
/* JavaCC - OriginalChecksum=1d70bcaf73c58a19d4427d29908696e5 (do not edit this line) */
Loading

0 comments on commit bb352ce

Please sign in to comment.