3.8. Identifiers

Identifier:
    IdentifierChars but not a Keyword or BooleanLiteral or NullLiteral

IdentifierChars:
    JavaLetter
    IdentifierChars JavaLetterOrDigit

JavaLetter:
    any Unicode character that is a Java letter (see below)

JavaLetterOrDigit:
    any Unicode character that is a Java letter-or-digit (see below)

  

15.8. Primary Expressions

Primary:
    PrimaryNoNewArray
    ArrayCreationExpression

PrimaryNoNewArray:
    Literal
    Type . class
    void . class
    this
    ClassName . this
    ( Expression )
    ClassInstanceCreationExpression
    FieldAccess
    MethodInvocation
    ArrayAccess

15.8.1. Lexical Literals

Literal:
    IntegerLiteral
    FloatingPointLiteral
    BooleanLiteral
    CharacterLiteral
    StringLiteral
    NullLiteral

  

  

15.9. Class Instance Creation Expressions

ClassInstanceCreationExpression:
    new TypeArgumentsopt TypeDeclSpecifier TypeArgumentsOrDiamondopt
                                                            ( ArgumentListopt ) ClassBodyopt
    Primary . new TypeArgumentsopt Identifier TypeArgumentsOrDiamondopt
                                                            ( ArgumentListopt ) ClassBodyopt

TypeArgumentsOrDiamond:
    TypeArguments
    <> 

ArgumentList:
    Expression
    ArgumentList , Expression

15.10. Array Creation Expressions

ArrayCreationExpression:
    new PrimitiveType DimExprs Dimsopt
    new ClassOrInterfaceType DimExprs Dimsopt
    new PrimitiveType Dims ArrayInitializer
    new ClassOrInterfaceType Dims ArrayInitializer

DimExprs:
    DimExpr
    DimExprs DimExpr

DimExpr:
    [ Expression ]

Dims:
    [ ]
    Dims [ ]

 

15.11. Field Access Expressions

FieldAccess:
    Primary . Identifier
    super . Identifier
    ClassName . super . Identifier

15.12. Method Invocation Expressions

MethodInvocation:
    MethodName ( ArgumentListopt )
    Primary . NonWildTypeArgumentsopt Identifier ( ArgumentListopt )
    super . NonWildTypeArgumentsopt Identifier ( ArgumentListopt )
    ClassName . super . NonWildTypeArgumentsopt Identifier ( ArgumentListopt )
    TypeName . NonWildTypeArguments Identifier ( ArgumentListopt )

The definition of ArgumentList from §15.9 is repeated here for convenience:  

ArgumentList:
    Expression
    ArgumentList , Expression

  

15.13. Array Access Expressions

ArrayAccess:
    ExpressionName [ Expression ]
    PrimaryNoNewArray [ Expression ]

 

15.14. Postfix Expressions

PostfixExpression:
    Primary
    ExpressionName
    PostIncrementExpression
    PostDecrementExpression

15.14.2. Postfix Increment Operator ++

PostIncrementExpression:
    PostfixExpression ++

15.14.3. Postfix Decrement Operator --

PostDecrementExpression:
    PostfixExpression --

15.15. Unary Operators

UnaryExpression:
    PreIncrementExpression
    PreDecrementExpression
    + UnaryExpression
    - UnaryExpression
    UnaryExpressionNotPlusMinus

PreIncrementExpression:
    ++ UnaryExpression

PreDecrementExpression:
    -- UnaryExpression

UnaryExpressionNotPlusMinus:
    PostfixExpression
    ~ UnaryExpression
    ! UnaryExpression
    CastExpression

15.16. Cast Expressions

CastExpression:
    ( PrimitiveType ) UnaryExpression
    ( ReferenceType ) UnaryExpressionNotPlusMinus

  

15.17. Multiplicative Operators

MultiplicativeExpression:
    UnaryExpression
    MultiplicativeExpression * UnaryExpression
    MultiplicativeExpression / UnaryExpression
    MultiplicativeExpression % UnaryExpression

  

15.18. Additive Operators

AdditiveExpression:
    MultiplicativeExpression
    AdditiveExpression + MultiplicativeExpression
    AdditiveExpression - MultiplicativeExpression

  

15.19. Shift Operators

ShiftExpression:
    AdditiveExpression
    ShiftExpression << AdditiveExpression
    ShiftExpression >> AdditiveExpression
    ShiftExpression >>> AdditiveExpression

  

15.20. Relational Operators

RelationalExpression:
    ShiftExpression
    RelationalExpression < ShiftExpression
    RelationalExpression > ShiftExpression
    RelationalExpression <= ShiftExpression
    RelationalExpression >= ShiftExpression
    RelationalExpression instanceof ReferenceType

  

15.21. Equality Operators

EqualityExpression:
    RelationalExpression
    EqualityExpression == RelationalExpression
    EqualityExpression != RelationalExpression

  

15.22. Bitwise and Logical Operators

AndExpression:
    EqualityExpression
    AndExpression & EqualityExpression

ExclusiveOrExpression:
    AndExpression
    ExclusiveOrExpression ^ AndExpression

InclusiveOrExpression:
    ExclusiveOrExpression
    InclusiveOrExpression | ExclusiveOrExpression

  

 

15.23. Conditional-And Operator &&

ConditionalAndExpression:
    InclusiveOrExpression
    ConditionalAndExpression && InclusiveOrExpression

15.24. Conditional-Or Operator ||

ConditionalOrExpression:
    ConditionalAndExpression
    ConditionalOrExpression || ConditionalAndExpression

  

15.25. Conditional Operator ? :

ConditionalExpression:
    ConditionalOrExpression
    ConditionalOrExpression ? Expression : ConditionalExpression

  

  

15.26. Assignment Operators

AssignmentExpression:
    ConditionalExpression
    Assignment

Assignment:
    LeftHandSide AssignmentOperator AssignmentExpression

LeftHandSide:
    ExpressionName
    FieldAccess
    ArrayAccess

AssignmentOperator: one of
    = *= /= %= += -= <<= >>= >>>= &= ^= |=

  

15.27. Expression

Expression:
    AssignmentExpression

  

15.28. Constant Expressions

ConstantExpression:
    Expression
StatementExpression:
    Assignment
    PreIncrementExpression
    PreDecrementExpression
    PostIncrementExpression
    PostDecrementExpression
    MethodInvocation
    ClassInstanceCreationExpression

  

  

 

  

Primary:
    PrimaryNoNewArray
    ArrayCreationExpression
        new PrimitiveType DimExprs Dimsopt
	new ClassOrInterfaceType DimExprs Dimsopt
	new PrimitiveType Dims ArrayInitializer
	new ClassOrInterfaceType Dims ArrayInitializer

PrimaryNoNewArray:
    ( Expression )
    Literal

    this
    ClassName . this

    Type . class
    void . class
    ClassInstanceCreationExpression
        new TypeArgumentsopt TypeDeclSpecifier TypeArgumentsOrDiamondopt
                                                       ( ArgumentListopt ) ClassBodyopt
        Primary . new TypeArgumentsopt Identifier TypeArgumentsOrDiamondopt
                                                       ( ArgumentListopt ) ClassBodyopt
    FieldAccess
        Primary . Identifier
        super . Identifier
        ClassName . super . Identifier
    MethodInvocation
	MethodName ( ArgumentListopt )
	Primary . NonWildTypeArgumentsopt Identifier ( ArgumentListopt )
	super . NonWildTypeArgumentsopt Identifier ( ArgumentListopt )
	ClassName . super . NonWildTypeArgumentsopt Identifier ( ArgumentListopt )
	TypeName . NonWildTypeArguments Identifier ( ArgumentListopt )
    ArrayAccess
        ExpressionName [ Expression ]
        PrimaryNoNewArray [ Expression ]

  

  

 

  

 

  

JLS中表达式的所有文法的更多相关文章

  1. .Net 中表达式的转换

    .Net 中表达式的转换 如: a>0  && (c>a || a <b ) || (a>b || c>1)    转换后  (((a > 0) a ...

  2. Python中表达式和语句及for、while循环练习

    Python中表达式和语句及for.while循环练习 1)表达式 常用的表达式操作符: x + y, x - y x * y, x / y, x // y, x % y 逻辑运算: x or y, ...

  3. JavaScript中:表达式和语句的区别

    JavaScript中:表达式和语句的区别 Javascript语言精粹:表达式是由运算符构成,并运算产生结果的语法结构.程序是由语句构成,语句则是由“:(分号)”分隔的句子或命令.如果在表达式后面加 ...

  4. 使用XtraReport的CalculatedFiled(计算字段)实现RDLC报表中表达式

    DevExpress报表确实强大,花样繁多,眼花缭乱. 这次使用XtraReport开发报表,很多问题在官方的文档中并没有详细的说明,特此记录. 1.XtraReport中FormattingRule ...

  5. Javascript中表达式和语句的区别

    一.表达式:一个表达式会产生一个值,它可以放在任何需要一个值的地方,比如,作为一个函数调用的参数. 以下例子就是表达式: a=35: b=1+a; a=function (){return 6}: b ...

  6. Python中表达式与语句

    简述 Python中我暂时并未发现谁对着两个名词的明确定义:我对这两个名词的理解就是,表达式就是你想要执行的对象,语句就是你的具体执行操作. 这里应用慕课网老师的一段话,摘自网上"表达式(E ...

  7. js中表达式 >>> 0 浅析 (以及用php简单翻译)

    今天在看lodash的源码中slice这个函数实现的时候发现了里面有这么一行代码 length = start > end ? 0 : ((end - start) >>> 0 ...

  8. PHP:第三章——PHP中表达式函数和匿名函数

    <?php header("Content-Type:text/html;charset=utf-8"); //表达式函数和匿名函数 /*$A=function(){ ech ...

  9. $-------JSP中表达式语言的$特殊字符的作用

    JSP 中EL表达式用法详解 EL 全名为Expression Language EL 语法很简单,它最大的特点就是使用上很方便.接下来介绍EL主要的语法结构: ${sessionScope.user ...

随机推荐

  1. Jersey RESTful WebService框架学习(六)接收MultivaluedMap类型参数

    现在的web开发中有些工程会觉得实体bean的架构会比较重,现在的持久层的框架的特点也层出不穷,核心思想的ORM在此基础上,提供了很多便捷操作,mybatis,jfinal(内部持久层框架)之类的也诞 ...

  2. redis.conf之save配置项解读

    配置示例: save 900 1 save 300 10 save 60 3600 配置解读: 1) “save 900 1”表示如果900秒内至少1个key发生变化(新增.修改和删除),则重写rdb ...

  3. MFC模块状态(一)

    先看一个例子: 1.创建一个动态链接到MFC DLL的规则DLL,其内部包含一个对话框资源.指定该对话框ID如下:              #define IDD_DLL_DIALOG  2000 ...

  4. css3种引入方式,样式与长度颜色,常用样式,css选择器

    # CSS三种引入方式 ## 一.三种方式的书写规范 #### 1.行间式 ```html<div style="width: 100px; height: 100px; backgr ...

  5. Django URLs error: view must be a callable or a list/tuple in the case of include()

    Django 1.10 no longer allows you to specify views as a string (e.g. 'myapp.views.home') in your URL ...

  6. 主题模型之概率潜在语义分析(Probabilistic Latent Semantic Analysis)

    上一篇总结了潜在语义分析(Latent Semantic Analysis, LSA),LSA主要使用了线性代数中奇异值分解的方法,但是并没有严格的概率推导,由于文本文档的维度往往很高,如果在主题聚类 ...

  7. C#把汉字转换成16进制(HEX)并向串口发送数据

    报警器实例:(有发送,无返回获取) using System; using System.Collections.Generic; using System.Linq; using System.Te ...

  8. dbcp和druid(数据库连接池)

    前言: 对于一个简单的数据库应用,由于对于数据库的访问不是很频繁.这时可以简单地在需要访问数据库时,就新创建一个连接,用完后就关闭它,这样做也不会带来什么明显的性能上的开销.但是对于一个复杂的数据库应 ...

  9. MySql字段类型说明

    bigint 从 -^ (-) 到 ^- () 的整型数据(所有数字).存储大小为 个字节. P.S. bigint已经有长度了,在mysql建表中的length,只是用于显示的位数 int 从 -^ ...

  10. Docker学习笔记——制作容器与容器概念

    Docker能做些什么? 1.docker能够解决虚拟机能够解决的问题 2.隔离应用依赖 3.创建应用镜像并复制 4.创建容易分发的即启即用的应用 5.docker的想法是创建软件程序可移植的轻量容器 ...