1/*---------------------------------------------------------------------------*
2 *  SR_LexicalAnalyzer.h  *
3 *                                                                           *
4 *  Copyright 2007, 2008 Nuance Communciations, Inc.                               *
5 *                                                                           *
6 *  Licensed under the Apache License, Version 2.0 (the 'License');          *
7 *  you may not use this file except in compliance with the License.         *
8 *                                                                           *
9 *  You may obtain a copy of the License at                                  *
10 *      http://www.apache.org/licenses/LICENSE-2.0                           *
11 *                                                                           *
12 *  Unless required by applicable law or agreed to in writing, software      *
13 *  distributed under the License is distributed on an 'AS IS' BASIS,        *
14 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
15 *  See the License for the specific language governing permissions and      *
16 *  limitations under the License.                                           *
17 *                                                                           *
18 *---------------------------------------------------------------------------*/
19
20#ifndef __SR_LEXICAL_ANALYZER_H
21#define __SR_LEXICAL_ANALYZER_H
22
23
24
25#include "SR_SemprocPrefix.h"
26#include "SR_SemprocDefinitions.h"
27
28#include "ptypes.h"
29#include "pstdio.h"
30
31#include "ESR_ReturnCode.h"
32
33/**
34 * The Lexical Analyzer
35 */
36typedef struct LexicalAnalyzer_t
37{
38  /**
39   * Pointer to the script to analyze .
40   */
41  LCHAR* script;
42
43  /**
44   * Pointer to the next token in the script.
45   */
46  LCHAR* nextToken;
47
48}
49LexicalAnalyzer;
50
51/**
52 * Create and Initialize
53 * @param self pointer to the newly created object
54 */
55SREC_SEMPROC_API ESR_ReturnCode LA_Init(LexicalAnalyzer **self);
56
57/**
58 * Startup the analysis
59 * @param self pointer to Lexical Analyzer
60 * @param script pointer to the script to analyze
61 */
62SREC_SEMPROC_API ESR_ReturnCode LA_Analyze(LexicalAnalyzer *self, LCHAR *script);
63
64/**
65 * Free
66 * @param self pointer to Lexical Analyzer
67 */
68SREC_SEMPROC_API ESR_ReturnCode LA_Free(LexicalAnalyzer *self);
69
70/**
71 * Gets the next token.
72 * @param self pointer to Lexical Analyzer
73 * @param token buffer to hold the next token
74 * @param tokenLen length of token
75 */
76SREC_SEMPROC_API ESR_ReturnCode LA_nextToken(LexicalAnalyzer *self, LCHAR* token, size_t* tokenLen);
77
78
79#endif /* __LEXICAL_ANALYZER_H */
80