diff options
Diffstat (limited to 'lib/token.h')
-rw-r--r-- | lib/token.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/token.h b/lib/token.h index a4072e0..6df2fb5 100644 --- a/lib/token.h +++ b/lib/token.h | |||
@@ -105,10 +105,17 @@ namespace verbly { | |||
105 | 105 | ||
106 | // Transform | 106 | // Transform |
107 | 107 | ||
108 | enum class casing { | ||
109 | normal, | ||
110 | capitalize, | ||
111 | all_caps, | ||
112 | title_case | ||
113 | }; | ||
114 | |||
108 | static token separator(std::string param, token inner); | 115 | static token separator(std::string param, token inner); |
109 | static token punctuation(std::string param, token inner); | 116 | static token punctuation(std::string param, token inner); |
110 | static token definiteArticle(token inner); | 117 | static token definiteArticle(token inner); |
111 | static token capitalize(token inner); | 118 | static token capitalize(casing param, token inner); |
112 | 119 | ||
113 | token& getInnerToken(); | 120 | token& getInnerToken(); |
114 | const token& getInnerToken() const; | 121 | const token& getInnerToken() const; |
@@ -118,7 +125,7 @@ namespace verbly { | |||
118 | std::string compileHelper( | 125 | std::string compileHelper( |
119 | std::string separator, | 126 | std::string separator, |
120 | bool definiteArticle, | 127 | bool definiteArticle, |
121 | bool capitalize) const; | 128 | casing capitalization) const; |
122 | 129 | ||
123 | enum class transform_type { | 130 | enum class transform_type { |
124 | separator, | 131 | separator, |
@@ -132,6 +139,11 @@ namespace verbly { | |||
132 | std::string param, | 139 | std::string param, |
133 | token inner); | 140 | token inner); |
134 | 141 | ||
142 | token( | ||
143 | transform_type type, | ||
144 | casing param, | ||
145 | token inner); | ||
146 | |||
135 | union { | 147 | union { |
136 | struct { | 148 | struct { |
137 | word word_; | 149 | word word_; |
@@ -143,7 +155,8 @@ namespace verbly { | |||
143 | std::list<token> utterance_; | 155 | std::list<token> utterance_; |
144 | struct { | 156 | struct { |
145 | transform_type type_; | 157 | transform_type type_; |
146 | std::string param_; | 158 | std::string strParam_; |
159 | casing casingParam_; | ||
147 | std::unique_ptr<token> inner_; | 160 | std::unique_ptr<token> inner_; |
148 | } transform_; | 161 | } transform_; |
149 | }; | 162 | }; |