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//! 3.23.25 rainy weekend
51//! create a JSON string from the SemanticMarker
52//! https://semanticmarker.org/bot/setdevice/scott@konacurrents.com/PASS/M5AtomSocket/socket/on}
53//! Create a JSON knowing the "bot" syntax, eg. setdevice/USER/PASS/device/<set>/<flag>
54//! and others like set etc.
55//! Maybe not 'dev' here. Others cmddevice/USER/PASS
56//! return: {'set':<set>,"dev':
57//! Supports these for now:
58//!GET /set/{username}/{password}/{command}/{value}
59//!GET /send/{username}/{password}/{request}
60//! only support 'device' ones
61//!GET /setdevice/{username}/{password}/{devicename}/{command}/{value}
62//!GET /senddevice/{username}/{password}/{device}/{request}
63//!return "" if not valid
64char *semanticMarkerToJSON_TokenParser(char* semanticMarker);
65
66//! 3.29.25 Raiiiinier Beeer movie last night
67//! add returning a UUID.FLOWNUM if valid, or nil if nota
68char *parseSM_For_UUID_Flownum(char* semanticMarker);
69
70#endif// TokenParser_h
71
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)
char * semanticMarkerToJSON_TokenParser(char *semanticMarker)
char * parseSM_For_UUID_Flownum(char *semanticMarker)