2362N/A * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * A class implementing a simple predictive parser for output format 0N/A * specification language for the jstat command. 0N/A * @author Brian Doherty 0N/A // allow both c++ style comments 0N/A * push back the lookahead token and restore the lookahead token 0N/A * to the previous token. 0N/A * retrieve the next token, placing the token value in the lookahead 0N/A * member variable, storing its previous value in the previous member 0N/A * match one of the token values in the given set of key words 0N/A * token is assumed to be of type TT_WORD, and the set is assumed 0N/A * to contain String objects. 0N/A * match a token with TT_TYPE=type, and the token value is a given sequence 0N/A * match a token with TT_TYPE=type 0N/A * match a token with TT_TYPE=char, where the token value is the given char. 0N/A * match a token with TT_TYPE='"', where the token value is a sequence 0N/A * of characters between matching quote characters. 0N/A * match a TT_NUMBER token that matches a parsed number value 0N/A * match a TT_WORD token that matches an arbitrary, not quoted token. 0N/A * match a TT_WORD token that matches the given string 0N/A * determine if the given word is a reserved key word 0N/A * determine if the give work is a reserved key word 0N/A * scalestmt -> 'scale' scalespec 0N/A * scalespec -> <see above scaleTerminals array> 0N/A * alignstmt -> 'align' alignspec 0N/A * alignspec -> <see above alignTerminals array> 0N/A * headerstmt -> 'header' quotedstring 0N/A * widthstmt -> 'width' integer 0N/A * formatstmt -> 'format' quotedstring 0N/A * Primary -> Literal | Identifier | '(' Expression ')' 0N/A * Unary -> ('+'|'-') Unary | Primary 0N/A * MultExpression -> Unary (('*' | '/') Unary)* 0N/A * AddExpression -> MultExpression (('+' | '-') MultExpression)* 0N/A * Expression -> AddExpression 0N/A * datastmt -> 'data' expression 0N/A * statementlist -> optionalstmt statementlist 0N/A * optionalstmt -> 'data' expression 0N/A * 'header' quotedstring 0N/A * 'format' formatstring 0N/A * optionlist -> columspec optionlist 0N/A * columspec -> 'column' '{' statementlist '}' 0N/A * optionstmt -> 'option' ID '{' optionlist '}' 0N/A * parse the specification for the given option identifier 0N/A * this search stops on the first occurance of an option 0N/A * statement with a name matching the given option. Any 0N/A * duplicate options are ignored. 0N/A // look for the start symbol 0N/A // skip tokens until a start symbol is found 0N/A // check if the option name is the one we are interested in 0N/A // this is the one we are looking for, parse it 0N/A // not what we are looking for, start skipping tokens 0N/A // look for the start symbol 0N/A // skip tokens until a start symbol is found 0N/A // note: if a duplicate option statement exists, then 0N/A // first one encountered is the chosen definition.