1 /* Generated by re2c */ 2 #line 1 "input_custom_istringstream.re" 3 // re2c $INPUT -o $OUTPUT --input custom 4 #include <sstream> 5 lex(std::istringstream & is,const std::streampos limit)6bool lex (std::istringstream & is, const std::streampos limit) 7 { 8 std::streampos marker; 9 std::streampos ctxmarker; 10 # define YYCTYPE char 11 # define YYPEEK() is.peek () 12 # define YYSKIP() is.ignore () 13 # define YYBACKUP() marker = is.tellg () 14 # define YYBACKUPCTX() ctxmarker = is.tellg () 15 # define YYRESTORE() is.seekg (marker) 16 # define YYRESTORECTX() is.seekg (ctxmarker) 17 # define YYLESSTHAN(n) limit - is.tellg () < n 18 # define YYFILL(n) {} 19 20 #line 21 "input_custom_istringstream.c" 21 { 22 YYCTYPE yych; 23 if (YYLESSTHAN(13)) YYFILL(13); 24 yych = YYPEEK(); 25 switch (yych) { 26 case 'i': goto yy4; 27 default: goto yy2; 28 } 29 yy2: 30 YYSKIP(); 31 yy3: 32 #line 19 "input_custom_istringstream.re" 33 { return false; } 34 #line 35 "input_custom_istringstream.c" 35 yy4: 36 YYSKIP(); 37 YYBACKUP(); 38 yych = YYPEEK(); 39 switch (yych) { 40 case 'n': goto yy5; 41 default: goto yy3; 42 } 43 yy5: 44 YYSKIP(); 45 yych = YYPEEK(); 46 switch (yych) { 47 case 't': goto yy7; 48 default: goto yy6; 49 } 50 yy6: 51 YYRESTORE(); 52 goto yy3; 53 yy7: 54 YYSKIP(); 55 yych = YYPEEK(); 56 switch (yych) { 57 case ' ': goto yy8; 58 default: goto yy6; 59 } 60 yy8: 61 YYSKIP(); 62 yych = YYPEEK(); 63 switch (yych) { 64 case 'b': goto yy9; 65 default: goto yy6; 66 } 67 yy9: 68 YYSKIP(); 69 yych = YYPEEK(); 70 switch (yych) { 71 case 'u': goto yy10; 72 default: goto yy6; 73 } 74 yy10: 75 YYSKIP(); 76 yych = YYPEEK(); 77 switch (yych) { 78 case 'f': goto yy11; 79 default: goto yy6; 80 } 81 yy11: 82 YYSKIP(); 83 yych = YYPEEK(); 84 switch (yych) { 85 case 'f': goto yy12; 86 default: goto yy6; 87 } 88 yy12: 89 YYSKIP(); 90 yych = YYPEEK(); 91 switch (yych) { 92 case 'e': goto yy13; 93 default: goto yy6; 94 } 95 yy13: 96 YYSKIP(); 97 yych = YYPEEK(); 98 switch (yych) { 99 case 'r': goto yy14; 100 default: goto yy6; 101 } 102 yy14: 103 YYSKIP(); 104 yych = YYPEEK(); 105 switch (yych) { 106 case ' ': goto yy15; 107 default: goto yy6; 108 } 109 yy15: 110 YYSKIP(); 111 yych = YYPEEK(); 112 switch (yych) { 113 case '[': 114 YYBACKUPCTX(); 115 goto yy16; 116 default: goto yy6; 117 } 118 yy16: 119 YYSKIP(); 120 yych = YYPEEK(); 121 switch (yych) { 122 case '0': 123 case '1': 124 case '2': 125 case '3': 126 case '4': 127 case '5': 128 case '6': 129 case '7': 130 case '8': 131 case '9': goto yy17; 132 default: goto yy6; 133 } 134 yy17: 135 YYSKIP(); 136 if (YYLESSTHAN(1)) YYFILL(1); 137 yych = YYPEEK(); 138 switch (yych) { 139 case '0': 140 case '1': 141 case '2': 142 case '3': 143 case '4': 144 case '5': 145 case '6': 146 case '7': 147 case '8': 148 case '9': goto yy17; 149 case ']': goto yy19; 150 default: goto yy6; 151 } 152 yy19: 153 YYSKIP(); 154 YYRESTORECTX(); 155 #line 18 "input_custom_istringstream.re" 156 { return true; } 157 #line 158 "input_custom_istringstream.c" 158 } 159 #line 20 "input_custom_istringstream.re" 160 161 } 162 main()163int main () 164 { 165 const char buffer [] = "int buffer [1024]"; 166 std::istringstream is (buffer); 167 return !lex (is, sizeof (buffer)); 168 } 169