12 package net.sf.gridarta.textedit.textarea.tokenmarker;
14 import javax.swing.text.Segment;
42 final char[] array = line.array;
43 final int offset = line.offset;
46 final int length = line.count + offset;
47 boolean backslash =
false;
49 byte currentToken = token;
51 for (
int i = offset; i <
length; i++) {
54 final char c = array[i];
56 backslash = !backslash;
60 switch (currentToken) {
68 addToken(i - lastOffset, currentToken);
81 addToken(i - lastOffset, currentToken);
97 addToken(i - lastOffset, currentToken);
110 if (!Character.isLetterOrDigit(c) && c !=
'_') {
120 }
else if (c ==
'"') {
121 addToken(i1 - lastOffset, currentToken);
131 }
else if (c ==
'\'') {
164 throw new InternalError(
"Invalid state: " + currentToken);
168 switch (currentToken) {
178 addToken(length - lastOffset, currentToken);
186 if (pythonKeywords == null) {
223 private void doKeyword(
final Segment line,
final int i) {
224 final int i1 = i + 1;
227 final byte
id = keywords.
lookup(line, lastKeyword, len);
229 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 final byte KEYWORD3
Keyword 3 token id.
final KeywordMap keywords
Base package of all Gridarta classes.
static final byte TRIPLE_QUOTE1
static KeywordMap getPythonKeywords()
Class with several utility functions used by jEdit's syntax colorizing subsystem. ...
This package contains the other part of the script editor.
byte markTokensImpl(final byte token, final Segment line)
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.
void doKeyword(final Segment line, final int i)
Maps (parts of) Segments to.
static final byte NULL
Normal text token id.
static final byte KEYWORD2
Keyword 2 token id.
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 KeywordMap pythonKeywords
static final byte TRIPLE_QUOTE2