Commit Graph

34 Commits

Author SHA1 Message Date
Corey Johnson
255df32f4d spelling 2013-01-07 14:22:39 -08:00
Nathan Sobo
188d8f8604 Store grammars on the syntax global 2012-12-31 18:26:58 -06:00
Kevin Sawicki
cf66892b09 💄 2012-12-26 11:38:15 -08:00
Corey Johnson & Nathan Sobo
1cc43adddb Break out atomic tokens in ScreenLine instead of TextMateGrammar
This paves the way for creating untokenized screen lines that still have leading whitespace and tab characters broken out appropriately.
2012-11-19 15:44:24 -07:00
Corey Johnson
1f7b92495a fix failing spec 2012-11-09 16:10:53 -08:00
Corey Johnson
f09a104524 Treat $base in textmate grammars as if it is $self
$base works as $self worked previously. $self will need to be fixed. If inside
a embedded grammar $self refers to the embedded grammar while $base refers to the
overall grammar.
2012-11-09 15:35:40 -08:00
Corey Johnson
00a26ae4da Fix how repositories work in TextMate grammars
Previously, we treated all grammar repositories as rules, but some
grammars have repositories that are a single pattern. If it is a single
pattern, transform it into a rule with one pattern.

Fix how repositories work in TextMate grammars

Previously, we treated all grammar repositories as rules, but some grammars have repositories that are a single pattern. If it is a single pattern, transform it into a rule with one pattern.
2012-11-08 16:47:36 -08:00
Corey Johnson & Nathan Sobo
89ef3f0f20 Build Token objects in TextMateGrammar. Tokenization-related renames. 2012-11-05 16:03:19 -07:00
Corey Johnson
41291021c4 Use entire filePath to determine its grammar 2012-11-01 17:47:31 -07:00
Corey Johnson & Nathan Sobo
fcbbe0a29b Do not use cached results for regexes that contain \G. 2012-10-22 11:04:20 -07:00
Corey Johnson
6171ea33e1 Add support for TextMate grammars with newlines in their regexes 2012-10-16 15:58:11 -07:00
Kevin Sawicki
f694d1d2c8 Update ruby bundle to commit 77dc5d13cc 2012-10-10 13:48:46 -07:00
Corey Johnson
701631e7cb Update spec to use new ruby scopes 2012-10-09 17:23:01 -07:00
Corey Johnson
6b5c3dc1cf Remove unused variable that causes specs to fail 2012-10-09 17:23:00 -07:00
Nathan Sobo
4e49fbec72 TextMate grammars can include other grammars 2012-09-28 17:28:40 -06:00
Corey Johnson & Nathan Sobo
82cecbf042 Add test for situation where we infinitely looped 2012-09-28 09:05:51 -07:00
Nathan Sobo
2dbba203a0 Allow begin/end rules with back-references to be nested 2012-09-26 12:10:00 -06:00
Nathan Sobo
9c8d897317 Start on a spec for nested begin/end rule w/ back-references in the end rule 2012-09-26 09:59:15 -06:00
Nathan Sobo
2d38650265 Linguistic 💄 2012-09-26 09:57:35 -06:00
Corey Johnson & Nathan Sobo
12e2fbdb14 Add support for back-references in TextMate grammars 2012-09-07 15:27:13 -07:00
Corey Johnson & Nathan Sobo
b00830cbc8 A pattern with no name or contentName does not insert undefined into scope array 2012-09-07 11:20:56 -07:00
Corey Johnson
4f2cc1f856 Add OnigRegExp.captureIndices(string, index, regexes)
Allows us to know if a zero-length regex matched.
2012-09-06 15:26:42 -07:00
Corey Johnson & Nathan Sobo
12b06ddf0c Get spec suite running (lots of failures) 2012-08-27 17:36:36 -05:00
Nathan Sobo
c2c8724ad0 Initial commit 2012-08-10 13:32:19 -06:00
Corey Johnson
c1bd922d89 💄 2012-08-09 15:17:01 -07:00
Nathan Sobo
f559ad73a7 Make grammar handle lines that don't match *any* of the current rule's patterns
It's possible to get a match based on a lookahead, but not actually have any non-empty capture groups. This should be considered a failed match.
2012-08-08 08:59:13 -06:00
Nathan Sobo
d520d6c859 WIP: Optimization: compile a single regex for each grammar rule
We compile a giant regex out of all the individual regexes for each pattern by or'ing together a capture group for each one. Then we use the index of the matched capture group to determine which pattern actually matched, and adjust the capture indexes of the subtree to make it appear to start from index 0, so the capture indices on the pattern align properly. There is still broken-ness on more complex patterns, but basic patterns and patterns w/ captures work.
2012-08-06 18:32:55 -06:00
Nathan Sobo
7bc6a5f24b TextMateGrammar handles nested capture groups and trailing lookahead captures
Our previous implementation only allowed for a single layer of capture groups. Now we can have captures within captures. I achieved this by converting the match into a tree before generating tokens. If there are any capture scopes specified, then we will always emit a token for every capture group in the match. This may create some redundant tokens (a serious of 2 or more tokens with the same scopes), but it will at least be technically correct. I think the overhead of removing these redundancies exceeds the cost of maintaining them for now.
2012-08-06 16:35:33 -06:00
Nathan Sobo
0d6d16a438 Move TextMateGrammar.buildCaptureTree to .getCaptureTree method on OnigRegExp 2012-08-06 11:43:44 -06:00
Nathan Sobo
32fc042929 Add TextMateGrammar.buildCaptureTree, which organizes nested captures in a tree
This will be a weapon in dealing with capture groups that nest within other capture groups, and also helps deal with trailing lookahead groups that don't belong in the main match. I made it a class method because it's stateless and that made it easier to test.
2012-08-03 23:52:58 -06:00
Nathan Sobo
fd28a3577a Improve spec description 2012-08-03 23:51:14 -06:00
Corey Johnson & Nathan Sobo
0e1d3fe3a9 wip: fixing capture group problems 2012-08-03 11:38:45 -07:00
Corey Johnson
b378620c54 Add TextMateBundle which handles all bundle loading 2012-08-02 11:38:14 -07:00
Corey Johnson & Nathan Sobo
370e0b896e Add TextMateGrammar.loadFromBundles() 2012-08-01 16:58:31 -07:00