diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-02-14 23:53:10 +0100 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-02-14 23:53:10 +0100 |
commit | 0b93aa3ff50756fbb1d93c7134fe2cc7f093fa75 (patch) | |
tree | d4590db082256decf0ead29f9f59fab3d41b22a3 /src | |
parent | 8c9820889e0e23b3d6a349e3f85d3700f1462e3c (diff) |
Redefined public interface of ParserStateStack
Diffstat (limited to 'src')
-rw-r--r-- | src/core/parser/generic/ParserStateStack.hpp | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/src/core/parser/generic/ParserStateStack.hpp b/src/core/parser/generic/ParserStateStack.hpp index 68c4026..b106475 100644 --- a/src/core/parser/generic/ParserStateStack.hpp +++ b/src/core/parser/generic/ParserStateStack.hpp @@ -131,51 +131,59 @@ public: std::string currentCommandName(); /** - * Function that should be called whenever a new command starts. + * Function that should be called whenever a new command is reached. * - * @param name is the name of the command. - * @param args is a map from strings to variants (argument name and value). - * Note that the passed map will be modified. - * @param location is the location in the source file at which the command - * starts. + * @param name is the name of the command (including the namespace + * separator ':') and its corresponding location. Must be a string variant. + * @param args is a map variant containing the arguments that were passed to + * the command. */ - void start(const std::string &name, Variant::mapType &args, - const SourceLocation &location = SourceLocation{}); + void command(Variant name, Variant args); /** - * Function that should be called whenever a new command starts. + * Function that should be called whenever a new field starts. Fields of the + * same command may not be separated by calls to + */ + void fieldStart(); + + /** + * Function that should be called whenever a field ends. + */ + void fieldEnd(); + + /** + * Function that shuold be called whenever character data is found in the + * input stream. * - * @param name is the name of the command. - * @param args is a map from strings to variants (argument name and value). - * @param location is the location in the source file at which the command - * starts. + * @param data is a variant of any type containing the data that was parsed + * as data. */ - void start(std::string name, - const Variant::mapType &args = Variant::mapType{}, - const SourceLocation &location = SourceLocation{}); + void data(Variant data); /** - * Function called whenever a command ends. + * Function that should be called whenever an annotation starts. + * + * @param name is the name of the annotation class. + * @param args is a map variant containing the arguments that were passed + * to the annotation. */ - void end(); + void annotationStart(Variant name, Variant args); /** - * Function that should be called whenever data is available for the - * command. + * Function that should be called whenever an annotation ends. * - * @param data is the data that should be passed to the handler. - * @param field is the field number (the interpretation of this value - * depends on the format that is being parsed). + * @param name is the name of the annotation class that was ended. + * @param annotationName is the name of the annotation that was ended. */ - void data(const std::string &data, int field = 0); + void annotationEnd(Variant name, Variant annotationName); /** - * Returns a reference to the parser context the parser stack is currently - * working on. + * Function that should be called whenever a previously registered token + * is found in the input stream. * - * @return a reference to the parser context. + * @param token is string variant containing the token that was encountered. */ - ParserContext &getContext() { return ctx; } + void token(Variant token); }; } |