From 1ea396b98ee06b0ec56403b70d553ccc5b379b9a Mon Sep 17 00:00:00 2001 From: Jan Breuer <jan.breuer@jaybee.cz> Date: 周三, 19 6月 2013 18:19:44 +0800 Subject: [PATCH] Parse program data --- libscpi/inc/scpi/lexer.h | 65 ++++++-------------------------- 1 files changed, 13 insertions(+), 52 deletions(-) diff --git a/libscpi/inc/scpi/lexer.h b/libscpi/inc/scpi/lexer.h index 6aaeca6..c5d5a32 100644 --- a/libscpi/inc/scpi/lexer.h +++ b/libscpi/inc/scpi/lexer.h @@ -43,58 +43,19 @@ extern "C" { #endif -enum _token_type_t { - TokComma, - TokSemicolon, - TokQuiestion, - TokNewLine, - TokHexnum, - TokOctnum, - TokBinnum, - TokProgramMnemonic, - TokDecimalNumericProgramData, - TokSuffixProgramData, - TokArbitraryBlockProgramData, - TokSingleQuoteProgramData, - TokDoubleQuoteProgramData, - TokProgramExpression, - TokCompoundProgramHeader, - TokCommonProgramHeader, - TokCompoundQueryProgramHeader, - TokCommonQueryProgramHeader, - TokWhiteSpace, - TokUnknown, -}; -typedef enum _token_type_t token_type_t; - -struct _token_t { - token_type_t type; - const char * ptr; - int len; -}; -typedef struct _token_t token_t; - -struct _lex_state_t { - const char * buffer; - const char * pos; - int len; -}; -typedef struct _lex_state_t lex_state_t; - - -int SCPI_LexWhiteSpace(lex_state_t * state, token_t * token); -int SCPI_LexProgramHeader(lex_state_t * state, token_t * token); -int SCPI_LexQuestion(lex_state_t * state, token_t * token); -int SCPI_LexCharacterProgramData(lex_state_t * state, token_t * token); -int SCPI_LexDecimalNumericProgramData(lex_state_t * state, token_t * token); -int SCPI_LexSuffixProgramData(lex_state_t * state, token_t * token); -int SCPI_LexNondecimalNumericData(lex_state_t * state, token_t * token); -int SCPI_LexStringProgramData(lex_state_t * state, token_t * token); -int SCPI_LexArbitraryBlockProgramData(lex_state_t * state, token_t * token); -int SCPI_LexProgramExpression(lex_state_t * state, token_t * token); -int SCPI_LexComma(lex_state_t * state, token_t * token); -int SCPI_LexSemicolon(lex_state_t * state, token_t * token); -int SCPI_LexNewLine(lex_state_t * state, token_t * token); + int SCPI_LexWhiteSpace(lex_state_t * state, token_t * token); + int SCPI_LexProgramHeader(lex_state_t * state, token_t * token); + int SCPI_LexQuestion(lex_state_t * state, token_t * token); + int SCPI_LexCharacterProgramData(lex_state_t * state, token_t * token); + int SCPI_LexDecimalNumericProgramData(lex_state_t * state, token_t * token); + int SCPI_LexSuffixProgramData(lex_state_t * state, token_t * token); + int SCPI_LexNondecimalNumericData(lex_state_t * state, token_t * token); + int SCPI_LexStringProgramData(lex_state_t * state, token_t * token); + int SCPI_LexArbitraryBlockProgramData(lex_state_t * state, token_t * token); + int SCPI_LexProgramExpression(lex_state_t * state, token_t * token); + int SCPI_LexComma(lex_state_t * state, token_t * token); + int SCPI_LexSemicolon(lex_state_t * state, token_t * token); + int SCPI_LexNewLine(lex_state_t * state, token_t * token); #ifdef __cplusplus } -- Gitblit v1.9.1