Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
C-sharp language specification.2004.pdf
Скачиваний:
14
Добавлен:
23.08.2013
Размер:
2.55 Mб
Скачать

Annex A Grammar

1

2

3

4

5

6

7

expression: conditional-expression assignment

constant-expression: expression

boolean-expression: expression

8A.2.5 Statements

9statement:

10

labeled-statement

11

declaration-statement

12

embedded-statement

13

embedded-statement:

14

block

15

empty-statement

16

expression-statement

17

selection-statement

18

iteration-statement

19

jump-statement

20

try-statement

21

checked-statement

22

unchecked-statement

23

lock-statement

24

using-statement

25

yield-statement

26 block:

27{ statement-listopt }

28statement-list:

29

statement

30

statement-list statement

31 empty-statement:

32;

33labeled-statement:

34

identifier : statement

35

declaration-statement:

36

local-variable-declaration ;

37

local-constant-declaration ;

38

local-variable-declaration:

39

type local-variable-declarators

40

local-variable-declarators:

41

local-variable-declarator

42

local-variable-declarators , local-variable-declarator

43

local-variable-declarator:

44

identifier

45

identifier = local-variable-initializer

46

local-variable-initializer:

47

expression

48

array-initializer

445

 

C# LANGUAGE SPECIFICATION

 

1

local-constant-declaration:

 

2

const type constant-declarators

3

constant-declarators:

 

4

constant-declarator

 

5

constant-declarators , constant-declarator

6

constant-declarator:

 

7

identifier = constant-expression

8

expression-statement:

 

9

statement-expression ;

 

10

statement-expression:

 

11

invocation-expression

 

12

object-creation-expression

 

13

assignment

 

14

post-increment-expression

 

15

post-decrement-expression

 

16

pre-increment-expression

 

17

pre-decrement-expression

 

18

selection-statement:

 

19

if-statement

 

20

switch-statement

 

21

if-statement:

 

22

if ( boolean-expression

) embedded-statement

23

if ( boolean-expression ) embedded-statement else embedded-statement

24

boolean-expression:

 

25

expression

 

26

switch-statement:

 

27

switch ( expression )

switch-block

28 switch-block:

29{ switch-sectionsopt }

30switch-sections:

31

switch-section

32

switch-sections switch-section

33

switch-section:

34

switch-labels statement-list

35

switch-labels:

36

switch-label

37

switch-labels switch-label

38

switch-label:

39

case constant-expression :

40default :

41iteration-statement:

42

while-statement

43

do-statement

44

for-statement

45

foreach-statement

46

while-statement:

47

while ( boolean-expression ) embedded-statement

446

 

 

 

Annex A Grammar

1

do-statement:

 

 

2

do embedded-statement while

( boolean-expression )

;

3

for-statement:

 

 

4

for ( for-initializeropt ; for-conditionopt ; for-iteratoropt

) embedded-statement

5

for-initializer:

 

 

6

local-variable-declaration

 

 

7

statement-expression-list

 

 

8

for-condition:

 

 

9

boolean-expression

 

 

10

for-iterator:

 

 

11

statement-expression-list

 

 

12

statement-expression-list:

 

 

13

statement-expression

 

 

14

statement-expression-list , statement-expression

 

15

foreach-statement:

 

 

16

foreach ( type identifier in

expression ) embedded-statement

17

jump-statement:

 

 

18

break-statement

 

 

19

continue-statement

 

 

20

goto-statement

 

 

21

return-statement

 

 

22

throw-statement

 

 

23 break-statement:

24break ;

25continue-statement:

26continue ;

27goto-statement:

28

goto

identifier ;

29

goto

case constant-expression ;

30goto default ;

31return-statement:

32return expressionopt ;

33throw-statement:

34throw expressionopt ;

35try-statement:

36

try block catch-clauses

37

try block finally-clause

38

try block catch-clauses finally-clause

39

catch-clauses:

40

specific-catch-clauses general-catch-clauseopt

41

specific-catch-clausesopt general-catch-clause

42

specific-catch-clauses:

43

specific-catch-clause

44

specific-catch-clauses specific-catch-clause

45

specific-catch-clause:

46

catch ( class-type identifieropt ) block

447

C# LANGUAGE SPECIFICATION

1 general-catch-clause:

2catch block

3finally-clause:

4finally block

5checked-statement:

6checked block

7unchecked-statement:

8unchecked block

9lock-statement:

10

lock ( expression ) embedded-statement

11

using-statement:

12

using

( resource-acquisition ) embedded-statement

13

yield-statement:

14

yield

return expression ;

15yield break ;

16resource-acquisition:

17

local-variable-declaration

18

expression

 

19

namespace-declaration:

20

namespace qualified-identifier namespace-body ;opt

21

qualified-identifier:

 

22

identifier

 

23

qualified-identifier . identifier

24

namespace-body:

 

25

{ extern-alias-directivesopt using-directivesopt namespace-member-declarationsopt }

26

extern-alias-directives:

27

extern-alias-directive

28

extern-alias-directives extern-alias-directive

29

extern-alias-directive:

identifier ;

30

extern

alias

31

using-directives:

 

32

using-directive

 

33

using-directives using-directive

34

using-directive:

 

35

using-alias-directive

36

using-namespace-directive

37

using-alias-directive:

 

38

using

identifier

= namespace-or-type-name ;

39 using-namespace-directive:

40using namespace-name ;

41namespace-member-declarations:

42

namespace-member-declaration

43

namespace-member-declarations namespace-member-declaration

44

namespace-member-declaration:

45

namespace-declaration

46

type-declaration

448

Соседние файлы в предмете Электротехника