public class ScopeParser extends Object
rule[arg1, arg2, ..., argN] returns [ret1, ..., retN]
text is target language dependent. Java/C#/C/C++ would use "int i" but ruby/python would use "i". Languages with postfix types like Go, Swift use "x : T" notation or "T x".
Constructor and Description |
---|
ScopeParser() |
Modifier and Type | Method and Description |
---|---|
static Pair<Integer,Integer> |
_parsePostfixDecl(Attribute attr,
String decl,
ActionAST a,
Grammar g) |
static Pair<Integer,Integer> |
_parsePrefixDecl(Attribute attr,
String decl,
ActionAST a,
Grammar g) |
static int |
_splitArgumentList(String actionText,
int start,
int targetChar,
int separatorChar,
List<Pair<String,Integer>> args) |
static AttributeDict |
parse(ActionAST action,
String s,
char separator,
Grammar g) |
static Attribute |
parseAttributeDef(ActionAST action,
Pair<String,Integer> decl,
Grammar g)
For decls like "String foo" or "char *foo32[]" compute the ID
and type declarations.
|
static AttributeDict |
parseTypedArgList(ActionAST action,
String s,
Grammar g)
Given an arg or retval scope definition list like
|
static List<Pair<String,Integer>> |
splitDecls(String s,
int separatorChar)
Given an argument list like
|
public static AttributeDict parseTypedArgList(ActionAST action, String s, Grammar g)
Map<String, String>, int[] j3, char *foo32[3]
or
int i=3, j=a[34]+20
convert to an attribute scope.
public static AttributeDict parse(ActionAST action, String s, char separator, Grammar g)
public static Attribute parseAttributeDef(ActionAST action, Pair<String,Integer> decl, Grammar g)
public static Pair<Integer,Integer> _parsePrefixDecl(Attribute attr, String decl, ActionAST a, Grammar g)
public static Pair<Integer,Integer> _parsePostfixDecl(Attribute attr, String decl, ActionAST a, Grammar g)
public static List<Pair<String,Integer>> splitDecls(String s, int separatorChar)
x, (*a).foo(21,33), 3.2+1, '\n', "a,oo\nick", {bl, "fdkj"eck}, ["cat\n,", x, 43]
convert to a list of attributes. Allow nested square brackets etc... Set separatorChar to ';' or ',' or whatever you want.
Copyright © 1992–2020 ANTLR. All rights reserved.