@@ -29,13 +29,11 @@ package com.github.lppedd.cc.parser;
2929 return value;
3030 }
3131
32- private int getWsPushback(final CharSequence value ) {
33- final int length = value . length ();
32+ private int getWsPushback() {
33+ final int length = yylength ();
3434
3535 for (int i = length - 1 , count = 0 ; i >= 0 ; i-- , count++ ) {
36- final char c = value. charAt(i);
37-
38- if (! Character . isWhitespace(c)) {
36+ if (! Character . isWhitespace(yycharat(i))) {
3937 return count;
4038 }
4139 }
@@ -122,7 +120,8 @@ FooterType = [^\s:][^:\r\n]*
122120 }
123121
124122 {NL} {
125- yybegin(BODY_OR_FOOTERS ); // Discard newline
123+ // Discard newline
124+ yybegin(BODY_OR_FOOTERS );
126125 }
127126}
128127
@@ -138,12 +137,12 @@ FooterType = [^\s:][^:\r\n]*
138137 // Closes #16
139138 ^ {FooterType}{WS} / #.* {
140139 // Push back any terminating whitespace, which should be part of the footer value instead
141- yypushback(getWsPushback(yytext() ));
140+ yypushback(getWsPushback());
142141 yybegin(FOOTER_VALUE );
143142 return token(CCToken . Type . FOOTER_TYPE );
144143 }
145144
146- ^ [\s] + {
145+ ^\s + {
147146 // Discard whitespace after the subject
148147 }
149148
@@ -183,7 +182,7 @@ FooterType = [^\s:][^:\r\n]*
183182 // Closes #16
184183 ^ {FooterType}{WS} / #.* {
185184 // Push back any terminating whitespace, which should be part of the footer value instead
186- yypushback(getWsPushback(yytext() ));
185+ yypushback(getWsPushback());
187186 yybegin(FOOTER_VALUE );
188187 return token(CCToken . Type . FOOTER_TYPE );
189188 }
0 commit comments