Lines Matching refs:ts

43 bool parse_param_attributes(TokenStream* ts, vector<string>* attrs) {  in parse_param_attributes()  argument
44 while (ts->peek_next() != ")" && ts->peek_next() != ",") { in parse_param_attributes()
45 auto attr = ts->next(); in parse_param_attributes()
51 bool parse_product_of_identifiers(TokenStream* ts, TypeSpec* type_spec, in parse_product_of_identifiers() argument
54 if (!vet_identifier(ts->curr(), ts->filectx())) in parse_product_of_identifiers()
56 if (ts->curr() == type_spec->name) { in parse_product_of_identifiers()
57 ts->filectx().print_error("invalid name for an array specifier", ts->curr()); in parse_product_of_identifiers()
60 identifiers->push_back(ts->curr()); in parse_product_of_identifiers()
61 if (ts->next() == "]") { in parse_product_of_identifiers()
64 if (ts->curr() != "*") { in parse_product_of_identifiers()
65 ts->filectx().print_error("expected ']' or '*'", ""); in parse_product_of_identifiers()
68 ts->next(); // consume '*' in parse_product_of_identifiers()
72 bool parse_arrayspec(TokenStream* ts, TypeSpec* type_spec) { in parse_arrayspec() argument
76 if (ts->next() != "[") in parse_arrayspec()
79 if (ts->next().empty()) in parse_arrayspec()
82 auto c = ts->curr()[0]; in parse_arrayspec()
85 if (!parse_product_of_identifiers(ts, type_spec, &multipliers)) { in parse_arrayspec()
90 if (ts->curr().size() > 1 || count == 0 || count > 9) { in parse_arrayspec()
91 ts->filectx().print_error("only 1-9 explicit array count allowed", ""); in parse_arrayspec()
94 if (ts->next() != "]") { in parse_arrayspec()
95 ts->filectx().print_error("expected", "]"); in parse_arrayspec()
99 ts->filectx().print_error("expected array specifier", ""); in parse_arrayspec()
106 bool parse_typespec(TokenStream* ts, TypeSpec* type_spec) { in parse_typespec() argument
107 if (ts->peek_next() == ":") { in parse_typespec()
108 auto name = ts->curr(); in parse_typespec()
109 if (!vet_identifier(name, ts->filectx())) in parse_typespec()
114 ts->next(); in parse_typespec()
115 if (ts->next().empty()) in parse_typespec()
119 auto type = ts->curr(); in parse_typespec()
120 if (!vet_identifier(type, ts->filectx())) in parse_typespec()
125 if (ts->peek_next() == "[" && !parse_arrayspec(ts, type_spec)) { in parse_typespec()
129 if (!parse_param_attributes(ts, &type_spec->attributes)) { in parse_typespec()
134 ts->filectx().print_error("expected", "IN, INOUT or OUT"); in parse_typespec()
140 bool parse_argpack(TokenStream* ts, vector<TypeSpec>* v) { in parse_argpack() argument
141 if (ts->curr() != "(") { in parse_argpack()
142 ts->filectx().print_error("expected", "("); in parse_argpack()
147 if (ts->next() == ")") in parse_argpack()
151 if (ts->curr() != ",") { in parse_argpack()
152 ts->filectx().print_error("expected", ", or :"); in parse_argpack()
155 ts->next(); in parse_argpack()
160 if (!parse_typespec(ts, &type_spec)) in parse_argpack()
167 bool process_comment(AbigenGenerator* parser, TokenStream& ts) { in process_comment() argument
168 if (ts.peek_next() == "!") { in process_comment()
169 ts.next(); // '!' in process_comment()
172 req.emplace_back(ts.next()); in process_comment()
173 if (ts.peek_next() == std::string()) in process_comment()
177 } else if (ts.peek_next() == "^") { in process_comment()
178 ts.next(); // '^' in process_comment()
181 td.emplace_back(ts.next()); in process_comment()
182 if (ts.peek_next() == std::string()) in process_comment()
190 bool process_syscall(AbigenGenerator* parser, TokenStream& ts) { in process_syscall() argument
191 auto name = ts.next(); in process_syscall()
193 if (!vet_identifier(name, ts.filectx())) in process_syscall()
196 Syscall syscall{ts.filectx(), name}; in process_syscall()
202 auto maybe_attr = ts.next(); in process_syscall()
210 if (!parse_argpack(&ts, &syscall.arg_spec)) in process_syscall()
213 auto return_spec = ts.next(); in process_syscall()
216 ts.next(); in process_syscall()
218 if (!parse_argpack(&ts, &syscall.ret_spec)) { in process_syscall()
229 ts.filectx().print_error("expected", ";"); in process_syscall()