Class Styler
Used for lexing and styling a document.
The same functionality can be achieved using lower-level Scintilla messages, this is merely to provide a higher-level interface. Make sure to check the examples.
See also:
Fields
Styler.startPos | Start of the range to be lexed. |
Styler.lengthDoc | Length of the range to be lexed. |
Styler.initStyle | Starting style. |
Methods
Styler:StartStyling(startPos, length, initStyle) | Start setting styles from startPos for length with initial style initStyle. |
Styler:EndStyling() | Styling has been completed so tidy up. |
Styler:More() | Are there any more characters to process. |
Styler:Forward() | Move forward one character. |
Styler:Position() | What is the position in the document of the current character. |
Styler:AtLineStart() | Is the current character the first on a line. |
Styler:AtLineEnd() | Is the current character the last on a line. |
Styler:State() | The current lexical state value. |
Styler:SetState() | Set the style of the current token to the current state and then change the state to the argument. |
Styler:ForwardSetState() | Combination of moving forward and setting the state. |
Styler:ChangeState(state) | Change the current state so that the state of the current token will be set to the argument. |
Styler:Current() | The current character. |
Styler:Next() | The next character. |
Styler:Previous() | The previous character. |
Styler:Token() | The current token. |
Styler:Match(str) | Is the text from the current position the same as the argument? |
Styler:Line(position) | Convert a byte position into a line number. |
Styler:CharAt(position) | Unsigned byte value at argument. |
Styler:StyleAt(position) | Style value at argument. |
Styler:LevelAt(line) | Fold level for a line. |
Styler:SetLevelAt(line, level) | Set the fold level for a line. |
Styler:LineState(line) | State value for a line. |
Styler:SetLineState(line, state) | Set state value for a line. |
Fields
- Styler.startPos
-
Start of the range to be lexed.
- startPos int (readonly)
- Styler.lengthDoc
-
Length of the range to be lexed.
- lengthDoc int (readonly)
- Styler.initStyle
-
Starting style.
- initStyle int (readonly)
Methods
- Styler:StartStyling(startPos, length, initStyle)
-
Start setting styles from startPos for length with initial style initStyle.
Parameters:
- startPos int
- length int
- initStyle int
- Styler:EndStyling()
- Styling has been completed so tidy up.
- Styler:More()
-
Are there any more characters to process.
Returns:
-
boolean
- Styler:Forward()
- Move forward one character.
- Styler:Position()
-
What is the position in the document of the current character.
Returns:
-
int
- Styler:AtLineStart()
-
Is the current character the first on a line.
Returns:
-
boolean
- Styler:AtLineEnd()
-
Is the current character the last on a line.
Returns:
-
boolean
- Styler:State()
-
The current lexical state value.
Returns:
-
int
- Styler:SetState()
- Set the style of the current token to the current state and then change the state to the argument.
- Styler:ForwardSetState()
- Combination of moving forward and setting the state. Useful when the current character is a token terminator like " for a string.
- Styler:ChangeState(state)
-
Change the current state so that the state of the current token will be set to the argument.
Parameters:
- state int
- Styler:Current()
-
The current character.
Returns:
-
string
- Styler:Next()
-
The next character.
Returns:
-
string
- Styler:Previous()
-
The previous character.
Returns:
-
string
- Styler:Token()
-
The current token.
Returns:
-
string
- Styler:Match(str)
-
Is the text from the current position the same as the argument?
Parameters:
- str string
Returns:
-
boolean
- Styler:Line(position)
-
Convert a byte position into a line number.
Parameters:
- position int
Returns:
-
int
- Styler:CharAt(position)
-
Unsigned byte value at argument.
Parameters:
- position int
Returns:
-
int
- Styler:StyleAt(position)
-
Style value at argument.
Parameters:
- position int
Returns:
-
int
- Styler:LevelAt(line)
-
Fold level for a line.
Parameters:
- line int
Returns:
-
int
- Styler:SetLevelAt(line, level)
-
Set the fold level for a line.
Parameters:
- line int
- level int
- Styler:LineState(line)
-
State value for a line.
Parameters:
- line int
Returns:
-
int
- Styler:SetLineState(line, state)
-
Set state value for a line.
This can be used to store extra information from lexing, such as a current language mode, so that there is no need to look back in the document.
Parameters:
- line int
- state int