Skip to content

Commit

Permalink
Hide more yy-lexer details; remove leftover enum.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 314443346
  • Loading branch information
hzeller committed Jun 3, 2020
1 parent 88088bb commit dab929e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
13 changes: 4 additions & 9 deletions common/analysis/command_file_lexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,23 @@ enum ConfigTokenEnum {
CFG_TK_ERROR,
};

enum ConfigParserStateEnum {
PARSER_INIT,
PARSER_COMMAND,
};

class ConfigFileLexer : public FlexLexerAdapter<veribleCommandFileFlexLexer> {
using parent_lexer_type = FlexLexerAdapter<veribleCommandFileFlexLexer>;
using parent_lexer_type::Restart;

public:
explicit ConfigFileLexer(absl::string_view config);

// Main lexing function. Will be defined by Flex.
int yylex() override;

// Returns true if token is invalid.
bool TokenIsError(const verible::TokenInfo&) const override;
bool TokenIsError(const verible::TokenInfo&) const final;

// Runs the Lexer and attached command handlers
std::vector<TokenRange> GetCommandsTokenRanges();

private:
// Main lexing function. Will be defined by Flex.
int yylex() final;

TokenSequence tokens_;
};

Expand Down
10 changes: 5 additions & 5 deletions verilog/parser/verilog_lexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ class VerilogLexer : public verible::FlexLexerAdapter<verilogFlexLexer> {
public:
explicit VerilogLexer(const absl::string_view code);

// Main lexing function. Will be defined by Flex.
int yylex() override;

// Restart lexer with new input stream.
void Restart(absl::string_view) override;
void Restart(absl::string_view) final;

// Returns true if token is invalid.
bool TokenIsError(const verible::TokenInfo&) const override;
bool TokenIsError(const verible::TokenInfo&) const final;

// Filter predicate that can be used for testing and parsing.
static bool KeepSyntaxTreeTokens(const verible::TokenInfo&);

private:
// Main lexing function. Will be defined by Flex.
int yylex() final;

// These variables are controlled by the lexer code (verilog.lex).

// for macro call argument lexing
Expand Down

0 comments on commit dab929e

Please sign in to comment.