Package uk.co.real_logic.sbe.ir
Class GenerationUtil
java.lang.Object
uk.co.real_logic.sbe.ir.GenerationUtil
Common code generation utility functions to be used by the different language specific backends.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intCollect a run of tokens matching a signal.static intcollectFields(List<Token> tokens, int index, List<Token> fields) Collect the fields for a message.static intcollectGroups(List<Token> tokens, int index, List<Token> groups) Collect the groups for a message.static intcollectVarData(List<Token> tokens, int index, List<Token> varData) Collect the var data for a message.static intfindEndSignal(List<Token> tokens, int index, Signal signal, String name) Find the index of the end signal for a given name.static intfindSignal(List<Token> tokens, Signal signal) Find the first instance of a given signal.findSubGroupNames(List<Token> tokens) Find a list of subgroup names.getMessageBody(List<Token> tokens) Get the tokens for the message body by subtracting the message wrapper.
-
Constructor Details
-
GenerationUtil
public GenerationUtil()
-
-
Method Details
-
collectFields
Collect the fields for a message.- Parameters:
tokens- for the message.index- index at which to begin.fields- to collect the field tokens into.- Returns:
- resulting index.
-
collectGroups
Collect the groups for a message.- Parameters:
tokens- for the message.index- index at which to begin.groups- to collect the group tokens into.- Returns:
- resulting index.
-
collectVarData
Collect the var data for a message.- Parameters:
tokens- for the message.index- index at which to begin.varData- to collect the var data tokens into.- Returns:
- resulting index.
-
collect
Collect a run of tokens matching a signal.- Parameters:
signal- to match against.tokens- for the message.index- index at which to begin.collected- to collect the tokens into.- Returns:
- resulting index.
-
getMessageBody
Get the tokens for the message body by subtracting the message wrapper.- Parameters:
tokens- for the message.- Returns:
- the tokens for the message body by subtracting the message wrapper.
-
findEndSignal
Find the index of the end signal for a given name.- Parameters:
tokens- to search.index- to start from.signal- to match.name- to match.- Returns:
- index where found.
-
findSubGroupNames
Find a list of subgroup names.- Parameters:
tokens- to search.- Returns:
- list of names for the subgroups.
-
findSignal
Find the first instance of a given signal.- Parameters:
tokens- to search.signal- to search for.- Returns:
- index the signal was found at or -1 if not found.
-