X-Git-Url: http://plrg.eecs.uci.edu/git/?p=cdsspec-compiler.git;a=blobdiff_plain;f=grammer%2Futil.jj;h=901e2e6f6fac466097a50336d768546f5f50a9fa;hp=7e8b0c3dc788f2420527ceb4840fa121bc727e52;hb=114e1583393a6a214e41bf85adcf25344fc270cc;hpb=8cd44ecf2b3ae26173db7bbdc403585a94c11d6d diff --git a/grammer/util.jj b/grammer/util.jj index 7e8b0c3..901e2e6 100644 --- a/grammer/util.jj +++ b/grammer/util.jj @@ -49,6 +49,12 @@ public class UtilParser { return parser.FuncDecl(); } + public static VariableDeclaration parseDeclaration(String line) + throws ParseException { + InputStream input = new ByteArrayInputStream(line.getBytes()); + UtilParser parser = new UtilParser(input); + return parser.Declaration(); + } public static String stringArray2String(ArrayList content) { StringBuilder sb = new StringBuilder(); @@ -426,6 +432,17 @@ ArrayList FormalParamList() : } } +VariableDeclaration Declaration() : +{ + String type, param; +} +{ + (type = Type()) (param = .image) + { + return new VariableDeclaration(type, param); + } +} + VariableDeclaration TypeParam() : { String type, param;