SKIP

Top  Previous  Next

Scripts > Productions > SKIP

 

By means of the SKIP symbol sections of the text, for which there are no explicit rules can be skipped.

 

Remark: The skipped text is accessible by xState.str() or trim_right_copy( xState.str()).

 

The key word SKIP is a complex symbol. It's meaning depends on the context. It depends on:

 

1. its alternatives

 

A SKIP alternative is chosen, if none of the alternatives matches the actual text. In a production:

 

(

"}"

| "]"

| SKIP

)*

 

the SKIP alternative is chosen, if there is neither a "}" nor a "]" at the actual position of the input.

 

 

2. the possible followers

 

The SKIP symbol matches the text beginning at the actual position and ending at the position, where the text is matched by a symbol, which can follow the SKIP symbol. If there are competing followers, the match at the next position will be chosen.

 

For example

 

SKIP ( "]" | "}" )

 

recognizes in the input

 

"SKIP is a key word of TETRA ] }"

 

the text "SKIP is a key word of TETRA", because "]" follows immediately, while "}" follows at a later position.

The rule above (point 1) will have the same result. In the first pass of the loop, the SKIP symbol matches, in the second "]". In the third "}" will be recognized too.

But it must be taken into account, that what the SKIP symbol matches depends on the follower of the loop itself. In the following context:

 

Startrule ::= Rule1 Rule2

 

Rule1 ::=

(

"]"

| "}"

| SKIP

)*

 

Rule2 ::= "TETRA"

 

the SKIP symbol only would recognize "SKIP is a key word of".

 

Between the token, which shall be reached by SKIP and the actual position, there has to be a text, which cannot be recognized by the token. If a token, which follows SKIP, exists at the actual position in the source text, it will not be recognized and the parsing is stopped.

Example:

 

SKIP "a"  neither recognizes the text: "a", nor the text: "a a".

 

But:

 

SKIP? "a" recognizes the text: "a"

( SKIP | "a" ) "a"  recognizes the text: "a a"

 

 

Occurrences of SKIP symbols must be isolated from each other. A SKIP node may not have a second SKIP node as alternative and a second SKIP node may not follow it directly. The following isn't allowed:

 

(SKIP | ...)  |  (SKIP | ...)  // wrong

 

or

 

(SKIP | ...) ( SKIP | ...)  // wrong

 

 

The following cases aren't different, they have the same result:

 

SKIP?

SKIP*

 

A follower must be found at the actual position or at a later position. In the second case, the SKIP node is executed once. The case

 

SKIP+

 

differs in the circumstance, that there may not be a follower at the actual position, but there must be one at a later position. Again, the SKIP node is executed only once.

 

Remark: The function of the SKIP symbol doesn't depend on the project options!

 

E.g. SKIP "\n" will recognize the line end, even if '\n' belongs to the character, which are to be ignored.

 

 

Remark: The set of tokens, which can follow on SKIP is not dynamically changeable. If a placeholder token, which follows on SKIP, is augmented by a literal, this extension has no effect on the recognitions of the SKIP symbol.

 

 

Remark: The name of a skip node is constructed of "SKIP" and the number, which represents the node in a first set. For example: SKIP2 is a skip node, which is registered in the first set of its superior node by the number 2.



This page belongs to the TextTransformer Documentation

Home  Content  German