Skip to content

Package: ScannerState

ScannerState

Coverage

1: package de.fhdw.wtf.dsl.scanner.common;
2:
3: import de.fhdw.wtf.common.stream.TokenStream;
4: import de.fhdw.wtf.common.token.Position;
5: import de.fhdw.wtf.dsl.scanner.modelScanner.state.ScannerStateVisitor;
6:
7: /**
8: * This state represents a possible state of the Scanner while scanning the input stream. Instances of this state have
9: * to process incoming characters for the scanner.
10: */
11: public interface ScannerState {
12:         
13:         /**
14:          * Processes the given input char and returns the next state of the Scanner. If the state completely processed a
15:          * char, a token in the outputstream is generated.
16:          *
17:          * @param input
18:          * character to be processed in this state
19:          * @param outputStream
20:          * for resulting Tokens
21:          * @param position
22:          * position of input char in original stream
23:          */
24:         void process(char input, TokenStream outputStream, Position position);
25:         
26:         /**
27:          * Finishes this state. Creates all necessary tokens to present all information.
28:          *
29:          * @param outputStream
30:          * for resulting Tokens
31:          */
32:         void finish(TokenStream outputStream);
33:         
34:         /**
35:          * Accept-Operation.
36:          *
37:          * @param visitor
38:          * {@link ScannerStateVisitor}
39:          * @return Boolean
40:          */
41:         boolean accept(ScannerStateVisitor visitor);
42:         
43: }