Home | History | Annotate | Download | only in torque

Lines Matching refs:Item

35 base::Optional<ParseResult> Rule::RunAction(const Item* completed_item,
38 for (const Item* child : completed_item->Children()) {
58 std::vector<const Item*> Item::Children() const {
59 std::vector<const Item*> children;
60 for (const Item* current = this; current->prev_; current = current->prev_) {
69 std::string Item::SplitByChildren(const LexerResult& tokens) const {
71 if (const Item* child = Children()[0])
76 for (const Item* item : Children()) {
77 if (!item) continue;
79 s << item->GetMatchedInput(tokens).ToString();
85 void Item::CheckAmbiguity(const Item& other, const LexerResult& tokens) const {
171 const Item* RunEarleyAlgorithm(
173 std::unordered_set<Item, base::hash<Item>>* processed) {
175 std::vector<Item> worklist;
177 std::vector<Item> future_items;
180 std::vector<const Item*> completed_items;
181 std::unordered_map<std::pair<size_t, Symbol*>, std::set<const Item*>,
185 std::vector<const Item*> debug_trace;
192 worklist.push_back(Item{top_level.rule(0), 0, 0, 0});
199 const Item& item = *insert_result.first;
200 DCHECK_EQ(pos, item.pos());
204 if (!is_new) item.CheckAmbiguity(worklist.back(), tokens);
208 debug_trace.push_back(&item);
209 if (item.IsComplete()) {
212 for (const Item* parent : waiting[{item.start(), item.left()}]) {
213 worklist.push_back(parent->Advance(pos, &item));
216 Symbol* next = item.NextSymbol();
221 future_items.push_back(item.Advance(pos + 1, nullptr));
225 // Remember that this item is waiting for completion with {next}.
226 waiting[{pos, next}].insert(&item);
231 processed->find(Item{rule, rule->right().size(), pos, pos});
236 // When we complete an item that started at the current position
241 worklist.push_back(item.Advance(pos, &*already_completed));
243 worklist.push_back(Item{rule, 0, pos, pos});
252 processed->find(Item{top_level.rule(0), 1, 0, input_length});
258 const Item& last_item = *debug_trace.back();