< prev index next >

src/jdk.jcmd/share/classes/sun/tools/jstat/Parser.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 58,74 **** private static final String HEADER = "header"; private static final String WIDTH = "width"; private static final String FORMAT = "format"; private static final String ALIGN = "align"; private static final String SCALE = "scale"; private static final String START = OPTION; private static final Set<String> scaleKeyWords = Scale.keySet(); private static final Set<String> alignKeyWords = Alignment.keySet(); private static String[] otherKeyWords = { ! OPTION, COLUMN, DATA, HEADER, WIDTH, FORMAT, ALIGN, SCALE }; private static char[] infixOps = { OPERATOR_PLUS, OPERATOR_MINUS, OPERATOR_MULTIPLY, OPERATOR_DIVIDE }; --- 58,76 ---- private static final String HEADER = "header"; private static final String WIDTH = "width"; private static final String FORMAT = "format"; private static final String ALIGN = "align"; private static final String SCALE = "scale"; + private static final String FORCIBLY = "forcibly"; private static final String START = OPTION; private static final Set<String> scaleKeyWords = Scale.keySet(); private static final Set<String> alignKeyWords = Alignment.keySet(); + private static final Set<String> boolKeyWords = Set.of("true", "false"); private static String[] otherKeyWords = { ! OPTION, COLUMN, DATA, HEADER, WIDTH, FORMAT, ALIGN, SCALE, FORCIBLY }; private static char[] infixOps = { OPERATOR_PLUS, OPERATOR_MINUS, OPERATOR_MULTIPLY, OPERATOR_DIVIDE };
*** 443,459 **** --- 445,472 ---- cf.setExpression(e); log(pdebug, "Parsed: data -> " + e); } /** + * forciblystmt -> 'forcibly' expression + */ + private void forciblyStmt(ColumnFormat cf) throws ParserException, IOException { + match(FORCIBLY); + Token t = matchOne(boolKeyWords); + cf.setForcibly(Boolean.parseBoolean(t.sval)); + log(pdebug, "Parsed: forcibly -> " + cf.isForcibly()); + } + + /** * statementlist -> optionalstmt statementlist * optionalstmt -> 'data' expression * 'header' quotedstring * 'width' integer * 'format' formatstring * 'align' alignspec * 'scale' scalespec + * 'forcibly' boolean */ private void statementList(ColumnFormat cf) throws ParserException, IOException { while (true) { if (lookahead.ttype != StreamTokenizer.TT_WORD) {
*** 470,479 **** --- 483,494 ---- formatStmt(cf); } else if (lookahead.sval.compareTo(ALIGN) == 0) { alignStmt(cf); } else if (lookahead.sval.compareTo(SCALE) == 0) { scaleStmt(cf); + } else if (lookahead.sval.compareTo(FORCIBLY) == 0) { + forciblyStmt(cf); } else { return; } } }
< prev index next >