longest1.groovy

来自「大名鼎鼎的java动态脚本语言。已经通过了sun的认证」· GROOVY 代码 · 共 29 行

GROOVY
29
字号
package gls.ch03.s02

/**
 * GLS 3.2: The longest possible translation is used at each step, even if the 
 * result does not ultimately make a correct program while another lexical 
 * translation would.
 * 
 * This is fundamental to the way the lexer works. If there is a problem with
 * it, other tests (e.g. to test functionality of operators or identifier
 * names) would expose it quickly. Nevertheless, we test some combinations
 * here for consistency.
 *
 * @author Alan Green
 */
class Longest1 extends GroovyTestCase {

    // Increment and decrement operators
    void testPrefixIncDec() {
        def a = 20
        def b = 10
        def c = a - b
        //c = a -- b // @fail:parse 
        //c = a ++ b // @fail:parse
        //c = a +- b // @pass
        //c = a -+ b // @pass
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?