ESP_IOT v2.5
IOT ESP Coding
TokenParser.h
Go to the documentation of this file.
1
2#ifndef TokenParser_h
3#define TokenParser_h
4
5#include "../../Defines.h"
6
7/*
8 <identifier> ::= {characters A-Z,a-z,0-9,_}
9 <notModifier> ::= '!'
10 <modifier> ::= <notModifier>
11 <wildcardAny> ::= '*'
12 <wildcard> ::= <wildcardAny>
13 <booleanAnd> ::= '&'
14 <booleanOr> ::= '|'
15 <booleanOps> ::= <booleanAnd> | <booleanOr> | <null>
16 <queryElement> ::= { [<modifier>] [<wildcard>] <identifier> [<wildcard>] }
17 <queryPart> ::= { <queryElement> <booleanOps> }
18
19 <identifierFollow> ::= {anything not <identifier> }
20 eg. ! M5* -> <notModifier> <identifier> <wildcard>
21 !*M5* & ! *GEN3* -> <wildcard=*> <identifier=M5> <wildcard=*> <booleanOps=&> <wildcard=*> <identifier=GEN3>
22 means: any non M5* and not *GEN3*
23
24
25 Currently presidence will be AND over OR (or just left to right)
26
27 Usage:
28 parseQueryLine_mainModule((char*)"M5* | DukeGEN3");
29 boolean queryMatchesName_mainModule("M5Duke");
30 */
31
32
33//!parses a line of text, The caller then uses queryMatchesName() to see if their name matches
34void parseQueryLine_mainModule(char *line);
35
36//!now need to process the token tree to see if name1 and name2 match the query
37//!eg. ! *name* & name2 ...
38//!wildcards after name make it slightly complicated
39//! SO: look for wildcards before and after, and the id. then decide if that matches
40//! before the boolean and notmodifier applied
41boolean queryMatchesName_mainModule(char*name);
42
43//! whether the stirng is a potential query. This can be used, but it is also used by the parseQueryLine
44//! to optimize out the original dev:name query.
45boolean stringIsQuery_mainModule(char *line);
46
47//! setup for the token parser (really just for testing)
49
50#endif// TokenParser_h
51
boolean stringIsQuery_mainModule(char *line)
whether the stirng is a potential query
boolean queryMatchesName_mainModule(char *name)
void parseQueryLine_mainModule(char *line)
parses a line of text, The caller then uses queryMatchesName() to see if their name matches
void setup_tokenParser_mainModule()
setup for the token parser (really just for testing)