16 package net.sf.gridarta.textedit.textarea.tokenmarker;
18 import javax.swing.text.Segment;
49 final char[] array = line.array;
50 final int offset = line.offset;
53 final int length = line.count + offset;
54 boolean backslash =
false;
56 byte currentToken = token;
58 for (
int i = offset; i <
length; i++) {
61 final char c = array[i];
63 backslash = !backslash;
67 switch (currentToken) {
74 if (i < length && array[i1] ==
'-') {
76 addToken(i - lastOffset, currentToken);
91 if (i < length && array[i1] ==
'[') {
93 addToken(i - lastOffset, currentToken);
102 addToken(i - lastOffset, currentToken);
109 addToken(i - lastOffset, currentToken);
115 if (!Character.isLetterOrDigit(c) && c !=
'_') {
124 }
else if (c ==
'\'') {
134 }
else if (c ==
'"') {
166 throw new InternalError(
"Invalid state: " + currentToken);
170 switch (currentToken) {
182 addToken(length - lastOffset, currentToken);
190 if (luaKeywords == null) {
218 private void doKeyword(
final Segment line,
final int i) {
219 final int i1 = i + 1;
222 final byte
id = keywords.
lookup(line, lastKeyword, len);
224 if (lastKeyword != lastOffset) {
int length
The number of lines in the model being tokenized.
static final byte INTERNAL_FIRST
The first id that can be used for internal state in a token marker.
byte lookup(final Segment text, final int offset, final int length)
Looks up a key.
void add(final CharSequence keyword, final byte id)
Adds a key-value mapping.
static final byte COMMENT1
Comment 1 token id.
void addToken(final int length, final byte id)
Adds a token to the token list.
static final byte LITERAL1
Literal 1 token id.
static KeywordMap luaKeywords
static final byte DOUBLE_QUOTE
static final byte MULTI_LITERAL
Base package of all Gridarta classes.
static final byte SINGLE_QUOTE
void doKeyword(final Segment line, final int i)
static final byte OPERATOR
Operator token id.
final KeywordMap keywords
Class with several utility functions used by jEdit's syntax colorizing subsystem. ...
This package contains the other part of the script editor.
static final byte LITERAL2
Literal 2 token id.
static boolean regionMatches(final boolean ignoreCase, final Segment text, final int offset, final CharSequence match)
Checks if a sub-region of a.
Maps (parts of) Segments to.
static final byte NULL
Normal text token id.
byte markTokensImpl(final byte token, final Segment line)
A token marker that splits lines of text into tokens.
static final byte INTERNAL_LAST
The last id that can be used for internal state in a token marker.
static final byte KEYWORD1
Keyword 1 token id.
static final byte MULTI_COMMENT
static KeywordMap getLuaKeywords()