Files
textmate/Frameworks/parse/src/parse.h
Allan Odgaard e27f9f4071 Fix scopes when re-running parser on captures
If we have multiple overlapping captures and define rules for one of these, the scopes would not be stacked correctly.

Unfortunately the fix (for this rare edge case) does degrade parser speed, as we need to switch to an alternative way of keeping track of scopes, yet for injection grammars, we need to also keep the old system (to have the “current” scope available as a scope_t instance), so while the new system is almost as fast as the old, using both is not.

There should be a few ways to optimize scope_t construction, so that this part will add less overhead in the future (I think it’s roughly 5-10% of parsing time spent to scope_t related stuff).
2013-08-25 17:58:08 +02:00

19 lines
485 B
C++

#ifndef GRAMMAR_TYPES_H_4M8CRK03
#define GRAMMAR_TYPES_H_4M8CRK03
#include <scope/scope.h>
#include <oak/misc.h>
#include <oak/debug.h>
namespace parse
{
struct stack_t;
typedef std::shared_ptr<stack_t> stack_ptr;
PUBLIC stack_ptr parse (char const* first, char const* last, stack_ptr stack, std::map<size_t, scope::scope_t>& scopes, bool firstLine);
PUBLIC bool equal (stack_ptr lhs, stack_ptr rhs);
} /* parse */
#endif /* end of include guard: GRAMMAR_TYPES_H_4M8CRK03 */