mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
[textmate] don't try to close root selector (IJPL-161230)
GitOrigin-RevId: 93a1a9b4583950abc5f1b0ab9cd592e22837c20a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ffaa1a9f2e
commit
e3f1e28a62
@@ -333,10 +333,12 @@ public final class TextMateLexer {
|
||||
if (lastOpenedName != null && !lastOpenedName.isEmpty()) {
|
||||
addToken(output, position);
|
||||
}
|
||||
int nested = myNestedScope.getInt(myNestedScope.size() - 1);
|
||||
myNestedScope.removeInt(myNestedScope.size() - 1);
|
||||
for (int i = 0; i < nested; i++) {
|
||||
myCurrentScope = myCurrentScope.getParentOrSelf();
|
||||
if (!myNestedScope.isEmpty()) {
|
||||
int nested = myNestedScope.getInt(myNestedScope.size() - 1);
|
||||
myNestedScope.removeInt(myNestedScope.size() - 1);
|
||||
for (int i = 0; i < nested; i++) {
|
||||
myCurrentScope = myCurrentScope.getParentOrSelf();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
86
plugins/textmate/testData/lexer/rst/nested.rst
Normal file
86
plugins/textmate/testData/lexer/rst/nested.rst
Normal file
@@ -0,0 +1,86 @@
|
||||
=========================================
|
||||
ReStructuredText (rst): plain text markup
|
||||
=========================================
|
||||
|
||||
.. sectnum::
|
||||
|
||||
.. contents:: The tiny table of contents
|
||||
|
||||
What is reStructuredText?
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
An easy-to-read, what-you-see-is-what-you-get plaintext markup syntax
|
||||
and parser system, abbreviated *rst*. In other words, using a simple
|
||||
text editor, documents can be created which
|
||||
|
||||
- are easy to read in text editor and
|
||||
- can be *automatically* converted to
|
||||
|
||||
- html and
|
||||
- latex (and therefore pdf)
|
||||
|
||||
What is it good for?
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
reStructuredText can be used, for example, to
|
||||
|
||||
- write technical documentation (so that it can easily be offered as a
|
||||
pdf file or a web page)
|
||||
|
||||
- create html webpages without knowing html
|
||||
|
||||
- to document source code
|
||||
|
||||
Show me some formatting examples
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
You can highlight text in *italics* or, to provide even more emphasis
|
||||
in **bold**. Often, when describing computer code, we like to use a
|
||||
``fixed space font`` to quote code snippets.
|
||||
|
||||
We can also include footnotes [1]_. We could include source code files
|
||||
(by specifying their name) which is useful when documenting code. We
|
||||
can also copy source code verbatim (i.e. include it in the rst
|
||||
document) like this::
|
||||
|
||||
int main ( int argc, char *argv[] ) {
|
||||
printf("Hello World\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
We have already seen at itemised list in section `What is it good
|
||||
for?`_. Enumerated list and descriptive lists are supported as
|
||||
well. It provides very good support for including html-links in a
|
||||
variety of ways. Any section and subsections defined can be linked to,
|
||||
as well.
|
||||
|
||||
|
||||
Where can I learn more?
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
reStructuredText is described at
|
||||
http://docutils.sourceforge.net/rst.html. We provide some geeky small
|
||||
print in this footnote [2]_.
|
||||
|
||||
|
||||
Show me some more stuff, please
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
We can also include figures:
|
||||
|
||||
.. figure:: image.png
|
||||
:width: 300pt
|
||||
|
||||
|
||||
The magnetisation in a small ferromagnetic disk. The diametre is of the order of 120 nanometers and the material is Ni20Fe80. Png is a file format that is both acceptable for html pages as well as for (pdf)latex.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
.. [1] although there isn't much point of using a footnote here.
|
||||
|
||||
.. [2] Random facts:
|
||||
|
||||
- Emacs provides an rst mode
|
||||
- when converting rst to html, a style sheet can be provided (there is a similar feature for latex)
|
||||
- rst can also be converted into XML
|
||||
- the recommended file extension for rst is ``.txt``
|
||||
225
plugins/textmate/testData/lexer/rst/nested_after.rst
Normal file
225
plugins/textmate/testData/lexer/rst/nested_after.rst
Normal file
@@ -0,0 +1,225 @@
|
||||
source.rst;markup.heading: [0, 41], {=========================================}
|
||||
source.rst: [41, 42], {
|
||||
}
|
||||
source.rst: [42, 84], {ReStructuredText (rst): plain text markup
|
||||
}
|
||||
source.rst;markup.heading: [84, 125], {=========================================}
|
||||
source.rst: [125, 126], {
|
||||
}
|
||||
source.rst;keyword.control.table: [126, 127], {
|
||||
}
|
||||
source.rst;keyword.control: [127, 139], {.. sectnum::}
|
||||
source.rst: [139, 140], {
|
||||
}
|
||||
source.rst;keyword.control.table: [140, 141], {
|
||||
}
|
||||
source.rst;keyword.control: [141, 154], {.. contents::}
|
||||
source.rst;variable: [154, 181], { The tiny table of contents}
|
||||
source.rst: [181, 182], {
|
||||
}
|
||||
source.rst;keyword.control.table: [182, 183], {
|
||||
}
|
||||
source.rst: [183, 209], {What is reStructuredText?
|
||||
}
|
||||
source.rst;markup.heading: [209, 234], {~~~~~~~~~~~~~~~~~~~~~~~~~}
|
||||
source.rst: [234, 235], {
|
||||
}
|
||||
source.rst;keyword.control.table: [235, 236], {
|
||||
}
|
||||
source.rst: [236, 306], {An easy-to-read, what-you-see-is-what-you-get plaintext markup syntax
|
||||
}
|
||||
source.rst: [306, 337], {and parser system, abbreviated }
|
||||
source.rst;markup.italic: [337, 339], {*r}
|
||||
source.rst;markup.italic: [339, 342], {st*}
|
||||
source.rst: [342, 375], {. In other words, using a simple
|
||||
}
|
||||
source.rst: [375, 419], {text editor, documents can be created which
|
||||
}
|
||||
source.rst;keyword.control.table: [419, 420], {
|
||||
}
|
||||
source.rst;keyword.control: [420, 422], {- }
|
||||
source.rst: [422, 458], {are easy to read in text editor and
|
||||
}
|
||||
source.rst;keyword.control: [458, 460], {- }
|
||||
source.rst: [460, 467], {can be }
|
||||
source.rst;markup.italic: [467, 469], {*a}
|
||||
source.rst;markup.italic: [469, 482], {utomatically*}
|
||||
source.rst: [482, 496], { converted to
|
||||
}
|
||||
source.rst;keyword.control.table: [496, 497], {
|
||||
}
|
||||
source.rst;keyword.control: [497, 501], { - }
|
||||
source.rst: [501, 510], {html and
|
||||
}
|
||||
source.rst;keyword.control: [510, 514], { - }
|
||||
source.rst: [514, 540], {latex (and therefore pdf)
|
||||
}
|
||||
source.rst;keyword.control.table: [540, 541], {
|
||||
}
|
||||
source.rst: [541, 562], {What is it good for?
|
||||
}
|
||||
source.rst;markup.heading: [562, 582], {~~~~~~~~~~~~~~~~~~~~}
|
||||
source.rst: [582, 583], {
|
||||
}
|
||||
source.rst;keyword.control.table: [583, 584], {
|
||||
}
|
||||
source.rst: [584, 630], {reStructuredText can be used, for example, to
|
||||
}
|
||||
source.rst;keyword.control.table: [630, 631], {
|
||||
}
|
||||
source.rst;keyword.control: [631, 633], {- }
|
||||
source.rst: [633, 702], {write technical documentation (so that it can easily be offered as a
|
||||
}
|
||||
source.rst: [702, 728], { pdf file or a web page)
|
||||
}
|
||||
source.rst;keyword.control.table: [728, 729], {
|
||||
}
|
||||
source.rst;keyword.control: [729, 731], {- }
|
||||
source.rst: [731, 773], {create html webpages without knowing html
|
||||
}
|
||||
source.rst;keyword.control.table: [773, 774], {
|
||||
}
|
||||
source.rst;keyword.control: [774, 776], {- }
|
||||
source.rst: [776, 800], {to document source code
|
||||
}
|
||||
source.rst;keyword.control.table: [800, 801], {
|
||||
}
|
||||
source.rst: [801, 834], {Show me some formatting examples
|
||||
}
|
||||
source.rst;markup.heading: [834, 866], {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
|
||||
source.rst: [866, 867], {
|
||||
}
|
||||
source.rst;keyword.control.table: [867, 868], {
|
||||
}
|
||||
source.rst: [868, 894], {You can highlight text in }
|
||||
source.rst;markup.italic: [894, 896], {*i}
|
||||
source.rst;markup.italic: [896, 903], {talics*}
|
||||
source.rst: [903, 938], { or, to provide even more emphasis
|
||||
}
|
||||
source.rst: [938, 941], {in }
|
||||
source.rst;markup.bold: [941, 944], {**b}
|
||||
source.rst;markup.bold: [944, 949], {old**}
|
||||
source.rst: [949, 1006], {. Often, when describing computer code, we like to use a
|
||||
}
|
||||
source.rst;string.interpolated: [1006, 1009], {``f}
|
||||
source.rst;string.interpolated: [1009, 1026], {ixed space font``}
|
||||
source.rst: [1026, 1051], { to quote code snippets.
|
||||
}
|
||||
source.rst;keyword.control.table: [1051, 1052], {
|
||||
}
|
||||
source.rst: [1052, 1082], {We can also include footnotes }
|
||||
source.rst;entity.name.tag: [1082, 1086], {[1]_}
|
||||
source.rst: [1086, 1123], {. We could include source code files
|
||||
}
|
||||
source.rst: [1123, 1192], {(by specifying their name) which is useful when documenting code. We
|
||||
}
|
||||
source.rst: [1192, 1255], {can also copy source code verbatim (i.e. include it in the rst
|
||||
}
|
||||
source.rst: [1255, 1274], {document) like this}
|
||||
source.rst;keyword.control: [1274, 1276], {::}
|
||||
source.rst: [1276, 1277], {
|
||||
}
|
||||
source.rst: [1277, 1278], {
|
||||
}
|
||||
source.rst: [1278, 1318], { int main ( int argc, char *argv[] ) {
|
||||
}
|
||||
source.rst: [1318, 1349], { printf("Hello World\n");
|
||||
}
|
||||
source.rst: [1349, 1365], { return 0;
|
||||
}
|
||||
source.rst: [1365, 1369], { }
|
||||
}
|
||||
source.rst: [1369, 1370], {
|
||||
}
|
||||
source.rst: [1370, 1419], {We have already seen at itemised list in section }
|
||||
source.rst;entity.name.tag: [1419, 1421], {`W}
|
||||
source.rst;entity.name.tag: [1421, 1436], {hat is it good
|
||||
}
|
||||
source.rst;entity.name.tag: [1436, 1442], {for?`_}
|
||||
source.rst: [1442, 1499], {. Enumerated list and descriptive lists are supported as
|
||||
}
|
||||
source.rst: [1499, 1565], {well. It provides very good support for including html-links in a
|
||||
}
|
||||
source.rst: [1565, 1636], {variety of ways. Any section and subsections defined can be linked to,
|
||||
}
|
||||
source.rst: [1636, 1645], {as well.
|
||||
}
|
||||
source.rst;keyword.control.table: [1645, 1646], {
|
||||
}
|
||||
source.rst;keyword.control.table: [1646, 1647], {
|
||||
}
|
||||
source.rst: [1647, 1671], {Where can I learn more?
|
||||
}
|
||||
source.rst;markup.heading: [1671, 1694], {~~~~~~~~~~~~~~~~~~~~~~~}
|
||||
source.rst: [1694, 1695], {
|
||||
}
|
||||
source.rst;keyword.control.table: [1695, 1696], {
|
||||
}
|
||||
source.rst: [1696, 1729], {reStructuredText is described at
|
||||
}
|
||||
source.rst: [1729, 1799], {http://docutils.sourceforge.net/rst.html. We provide some geeky small
|
||||
}
|
||||
source.rst: [1799, 1822], {print in this footnote }
|
||||
source.rst;entity.name.tag: [1822, 1826], {[2]_}
|
||||
source.rst: [1826, 1828], {.
|
||||
}
|
||||
source.rst;keyword.control.table: [1828, 1829], {
|
||||
}
|
||||
source.rst;keyword.control.table: [1829, 1830], {
|
||||
}
|
||||
source.rst: [1830, 1862], {Show me some more stuff, please
|
||||
}
|
||||
source.rst;markup.heading: [1862, 1893], {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
|
||||
source.rst: [1893, 1894], {
|
||||
}
|
||||
source.rst;keyword.control.table: [1894, 1895], {
|
||||
}
|
||||
source.rst: [1895, 1924], {We can also include figures:
|
||||
}
|
||||
source.rst;keyword.control.table: [1924, 1925], {
|
||||
}
|
||||
source.rst;keyword.control: [1925, 1936], {.. figure::}
|
||||
source.rst;variable: [1936, 1946], { image.png}
|
||||
source.rst: [1946, 1947], {
|
||||
}
|
||||
source.rst: [1947, 1950], { }
|
||||
source.rst;keyword.control: [1950, 1957], {:width:}
|
||||
source.rst: [1957, 1963], { 300pt}
|
||||
source.rst: [1963, 1964], {
|
||||
}
|
||||
source.rst;keyword.control.table: [1964, 1965], {
|
||||
}
|
||||
source.rst;keyword.control.table: [1965, 1966], {
|
||||
}
|
||||
source.rst: [1966, 2182], { The magnetisation in a small ferromagnetic disk. The diametre is of the order of 120 nanometers and the material is Ni20Fe80. Png is a file format that is both acceptable for html pages as well as for (pdf)latex.
|
||||
}
|
||||
source.rst;keyword.control.table: [2182, 2183], {
|
||||
}
|
||||
source.rst;markup.heading: [2183, 2258], {---------------------------------------------------------------------------}
|
||||
source.rst: [2258, 2259], {
|
||||
}
|
||||
source.rst;keyword.control.table: [2259, 2260], {
|
||||
}
|
||||
source.rst;entity.name.tag: [2260, 2267], {.. [1] }
|
||||
source.rst: [2267, 2325], {although there isn't much point of using a footnote here.
|
||||
}
|
||||
source.rst;keyword.control.table: [2325, 2326], {
|
||||
}
|
||||
source.rst;entity.name.tag: [2326, 2333], {.. [2] }
|
||||
source.rst: [2333, 2347], {Random facts:
|
||||
}
|
||||
source.rst;keyword.control.table: [2347, 2348], {
|
||||
}
|
||||
source.rst;keyword.control: [2348, 2352], { - }
|
||||
source.rst: [2352, 2379], {Emacs provides an rst mode
|
||||
}
|
||||
source.rst;keyword.control: [2379, 2383], { - }
|
||||
source.rst: [2383, 2481], {when converting rst to html, a style sheet can be provided (there is a similar feature for latex)
|
||||
}
|
||||
source.rst;keyword.control: [2481, 2485], { - }
|
||||
source.rst: [2485, 2520], {rst can also be converted into XML
|
||||
}
|
||||
source.rst;keyword.control: [2520, 2524], { - }
|
||||
source.rst: [2524, 2566], {the recommended file extension for rst is }
|
||||
source.rst;string.interpolated: [2566, 2569], {``.}
|
||||
source.rst;string.interpolated: [2569, 2574], {txt``}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.jetbrains.plugins.textmate.language.syntax.lexer
|
||||
|
||||
class RstLexerTest: LexerTestCase() {
|
||||
override fun getTestDirRelativePath(): String = "rst"
|
||||
|
||||
override fun getBundleName(): String = "restructuredtext"
|
||||
}
|
||||
Reference in New Issue
Block a user