ISO IEC 30170-2012 Information technology - Programming languages - Ruby《信息技术 编程语言 Ruby》.pdf

上传人:deputyduring120 文档编号:1257196 上传时间:2019-09-02 格式:PDF 页数:334 大小:2MB
下载 相关 举报
ISO IEC 30170-2012 Information technology - Programming languages - Ruby《信息技术 编程语言 Ruby》.pdf_第1页
第1页 / 共334页
ISO IEC 30170-2012 Information technology - Programming languages - Ruby《信息技术 编程语言 Ruby》.pdf_第2页
第2页 / 共334页
ISO IEC 30170-2012 Information technology - Programming languages - Ruby《信息技术 编程语言 Ruby》.pdf_第3页
第3页 / 共334页
ISO IEC 30170-2012 Information technology - Programming languages - Ruby《信息技术 编程语言 Ruby》.pdf_第4页
第4页 / 共334页
ISO IEC 30170-2012 Information technology - Programming languages - Ruby《信息技术 编程语言 Ruby》.pdf_第5页
第5页 / 共334页
点击查看更多>>
资源描述

1、 Reference number ISO/IEC 30170:2012(E) ISO/IEC 2012INTERNATIONAL STANDARD ISO/IEC 30170 First edition 2012-04-15 Information technology Programming languages Ruby Technologies de linformation Langages de programmation Ruby ISO/IEC 30170:2012(E) COPYRIGHT PROTECTED DOCUMENT ISO/IEC 2012 All rights r

2、eserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or ISOs member body in the country of the req

3、uester. ISO copyright office Case postale 56 CH-1211 Geneva 20 Tel. + 41 22 749 01 11 Fax + 41 22 749 09 47 E-mail copyrightiso.org Web www.iso.org Published in Switzerland ii ISO/IEC 2012 All rights reservedISO/IEC 30170:2012(E) Contents Page 1 Scope . . . . . . . . . . . . . . . . . . . . . . . .

4、. . . . . . . . . . . . . . . . . . . . 1 2 Normative references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 3 Conformance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 4 Terms and denitions . . . . . . . . . . . . . . . . . . . . . .

5、 . . . . . . . . . . . . . 2 5 Notational conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 5.1 General description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 5.2 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6、. . . . . . 4 5.2.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 5.2.2 Productions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 5.2.3 Syntactic term sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 5.2.4 Syntactic terms

7、 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 5.2.5 Conceptual names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 5.3 Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 5.4 Attributes of execution contexts . . . . . .

8、 . . . . . . . . . . . . . . . . . . . . 11 6 Fundamental concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 6.1 Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 6.2 Variables . . . . . . . . . . . . . . . . . . . . . . . . . .

9、 . . . . . . . . . . . . . 12 6.2.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 6.2.2 Instance variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 6.3 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10、 13 6.4 Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 6.5 Classes, singleton classes, and modules . . . . . . . . . . . . . . . . . . . . . . . 14 6.5.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 6.5.2 Classes . .

11、. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 6.5.3 Singleton classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 6.5.4 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 6.5.5 Modules . . . . . . . . . . . . . . . .

12、 . . . . . . . . . . . . . . . . . . . . . 17 6.6 Boolean values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 7 Execution contexts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 7.1 General description. . . . . . . . . . . . . . . . . . . .

13、 . . . . . . . . . . . . . . 18 7.2 The initial state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 8 Lexical structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 8.1 General description. . . . . . . . . . . . . . . . . . . . . . . . . .

14、 . . . . . . . . 19 8.2 Program text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 8.3 Line terminators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 8.4 Whitespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

15、1 8.5 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 8.6 End-of-program markers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 8.7 Tokens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 8.7.1 General desc

16、ription . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 8.7.2 Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 8.7.3 Identiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 8.7.4 Punctuators . . . . . . . . . . . . . . .

17、. . . . . . . . . . . . . . . . . . . 25 8.7.5 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 ISO/IEC 2012 All rights reserved iiiISO/IEC 30170:2012(E) 8.7.6 Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 8.7.6.1 General de

18、scription . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 8.7.6.2 Numeric literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 8.7.6.3 String literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 8.7.6.3.1 General description . . . . . . . . . . . . . .

19、. . . . . . . . . . 29 8.7.6.3.2 Single quoted strings . . . . . . . . . . . . . . . . . . . . . . . 29 8.7.6.3.3 Double quoted strings . . . . . . . . . . . . . . . . . . . . . . . 30 8.7.6.3.4 Quoted non-expanded literal strings . . . . . . . . . . . . . . . 33 8.7.6.3.5 Quoted expanded literal st

20、rings . . . . . . . . . . . . . . . . . 35 8.7.6.3.6 Here documents . . . . . . . . . . . . . . . . . . . . . . . . . . 36 8.7.6.3.7 External command execution . . . . . . . . . . . . . . . . . . . 38 8.7.6.4 Array literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 8.7.6.5 Reg

21、ular expression literals . . . . . . . . . . . . . . . . . . . . . . . 42 8.7.6.6 Symbol literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 9 Scope of variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 9.1 General description. . . . . . . . .

22、. . . . . . . . . . . . . . . . . . . . . . . . . 44 9.2 Scope of local variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 9.3 Scope of global variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 10 Program structure . . . . . . . . . . . . . . . . . . .

23、 . . . . . . . . . . . . . . . . . . 45 10.1 Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 10.2 Compound statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 11 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

24、. . . . . . . . . . . . 47 11.1 General description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 11.2 Logical expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 11.2.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . .

25、 . . 47 11.2.2 Logical NOT expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 11.2.3 Logical AND expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 11.2.4 Logical OR expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 11.3 Method invocation expr

26、essions . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 11.3.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 11.3.2 Method arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 11.3.3 Blocks . . . . . . . . . . . . . . . . . . . . .

27、. . . . . . . . . . . . . . . . . 58 11.3.4 The super expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 11.3.5 The yield expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 11.4 Operator expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

28、 . . . 65 11.4.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 11.4.2 Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 11.4.2.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 11.4.2.2 Single assignme

29、nts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 11.4.2.2.1 General description . . . . . . . . . . . . . . . . . . . . . . . . 66 11.4.2.2.2 Single variable assignments . . . . . . . . . . . . . . . . . . . . 67 11.4.2.2.3 Scoped constant assignments . . . . . . . . . . . . . . . . .

30、. . 69 11.4.2.2.4 Single indexing assignments. . . . . . . . . . . . . . . . . . . . 69 11.4.2.2.5 Single method assignments . . . . . . . . . . . . . . . . . . . . 70 11.4.2.3 Abbreviated assignments . . . . . . . . . . . . . . . . . . . . . . . . 71 11.4.2.3.1 General description . . . . . . . . .

31、 . . . . . . . . . . . . . . . 71 11.4.2.3.2 Abbreviated variable assignments . . . . . . . . . . . . . . . . 71 11.4.2.3.3 Abbreviated indexing assignments . . . . . . . . . . . . . . . . 72 11.4.2.3.4 Abbreviated method assignments . . . . . . . . . . . . . . . . 73 11.4.2.4 Multiple assignments .

32、 . . . . . . . . . . . . . . . . . . . . . . . . . 74 iv ISO/IEC 2012 All rights reservedISO/IEC 30170:2012(E) 11.4.2.5 Assignments with rescue modiers . . . . . . . . . . . . . . . . . . 78 11.4.3 Unary operator expressions . . . . . . . . . . . . . . . . . . . . . . . . . . 78 11.4.3.1 General des

33、cription . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 11.4.3.2 The defined? expression . . . . . . . . . . . . . . . . . . . . . . . . 79 11.4.4 Binary operator expressions . . . . . . . . . . . . . . . . . . . . . . . . . . 81 11.5 Primary expressions . . . . . . . . . . . . . . . . . .

34、 . . . . . . . . . . . . . . . 84 11.5.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 11.5.2 Control structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 11.5.2.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

35、 11.5.2.2 Conditional expressions . . . . . . . . . . . . . . . . . . . . . . . . . 85 11.5.2.2.1 General description . . . . . . . . . . . . . . . . . . . . . . . . 85 11.5.2.2.2 The if expression . . . . . . . . . . . . . . . . . . . . . . . . . 85 11.5.2.2.3 The unless expression . . . . . . . .

36、. . . . . . . . . . . . . . 87 11.5.2.2.4 The case expression . . . . . . . . . . . . . . . . . . . . . . . . 87 11.5.2.2.5 Conditional operator expression . . . . . . . . . . . . . . . . . 88 11.5.2.3 Iteration expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 11.5.2.3.1 General

37、description . . . . . . . . . . . . . . . . . . . . . . . . 89 11.5.2.3.2 The while expression . . . . . . . . . . . . . . . . . . . . . . . 90 11.5.2.3.3 The until expression . . . . . . . . . . . . . . . . . . . . . . . 91 11.5.2.3.4 The for expression . . . . . . . . . . . . . . . . . . . . . . .

38、 . 91 11.5.2.4 Jump expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 11.5.2.4.1 General description . . . . . . . . . . . . . . . . . . . . . . . . 92 11.5.2.4.2 The return expression . . . . . . . . . . . . . . . . . . . . . . 93 11.5.2.4.3 The break expression . . . . . . . .

39、 . . . . . . . . . . . . . . . 94 11.5.2.4.4 The next expression . . . . . . . . . . . . . . . . . . . . . . . . 95 11.5.2.4.5 The redo expression . . . . . . . . . . . . . . . . . . . . . . . . 96 11.5.2.4.6 The retry expression . . . . . . . . . . . . . . . . . . . . . . . 97 11.5.2.5 The begin ex

40、pression . . . . . . . . . . . . . . . . . . . . . . . . . . 97 11.5.3 Grouping expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 11.5.4 Variable references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 11.5.4.1 General description . . . . . . . . . . . . .

41、 . . . . . . . . . . . . . . 99 11.5.4.2 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 11.5.4.3 Scoped constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 11.5.4.4 Global variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 11.

42、5.4.5 Class variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 11.5.4.6 Instance variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 11.5.4.7 Local variables or method invocations . . . . . . . . . . . . . . . . . 102 11.5.4.7.1 General description . . . . .

43、. . . . . . . . . . . . . . . . . . . 102 11.5.4.7.2 Determination of the type of local variable identiers . . . . . 103 11.5.4.7.3 Local variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 11.5.4.7.4 Method invocations . . . . . . . . . . . . . . . . . . . . . . . . 104 11.5.4.8 Pse

44、udo variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 11.5.4.8.1 General description . . . . . . . . . . . . . . . . . . . . . . . . 104 11.5.4.8.2 The nil expression . . . . . . . . . . . . . . . . . . . . . . . . 104 11.5.4.8.3 The true expression and the false expression . .

45、 . . . . . . . 104 11.5.4.8.4 The self expression . . . . . . . . . . . . . . . . . . . . . . . . 105 11.5.5 Object constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 11.5.5.1 Array constructor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 11.5.5.2 Hash constr

46、uctor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 11.5.5.3 Range expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 12 Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 12.1 General description. . . . . . . . . .

47、. . . . . . . . . . . . . . . . . . . . . . . . 107 ISO/IEC 2012 All rights reserved vISO/IEC 30170:2012(E) 12.2 Expression statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 12.3 The if modier statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 12.4 Th

48、e unless modier statement . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 12.5 The while modier statement . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 12.6 The until modier statement . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 12.7 The rescue modier statement . .

49、 . . . . . . . . . . . . . . . . . . . . . . . . . 109 13 Classes and modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 13.1 Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 13.1.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 13.1.2 Module denition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 13.1.3 Module inclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 13.2 Classes . . . . . . . . . . .

展开阅读全文
相关资源
猜你喜欢
  • BS PD IEC TS 62763-2013_5284 Pilot function through a control pilot circuit using PWM (pulse width modulation) and a control pilot wire《通过控制导向线使用PWM (脉冲宽度调制) 的导向功能和控制导向线》.pdf BS PD IEC TS 62763-2013_5284 Pilot function through a control pilot circuit using PWM (pulse width modulation) and a control pilot wire《通过控制导向线使用PWM (脉冲宽度调制) 的导向功能和控制导向线》.pdf
  • BS ISO 8070-2007 Milk and milk products - Determination of calcium sodium potassium and magnesium contents - Atomic absorption spectrometric method《牛奶和奶制品 钙、钠、钾和镁含量的测定 原子吸.pdf BS ISO 8070-2007 Milk and milk products - Determination of calcium sodium potassium and magnesium contents - Atomic absorption spectrometric method《牛奶和奶制品 钙、钠、钾和镁含量的测定 原子吸.pdf
  • BS ISO 8082-1-2009 Self-propelled machinery for forestry - Laboratory tests and performance requirements for roll-over protective structures - General machines《林业用自推进机械 防倾.pdf BS ISO 8082-1-2009 Self-propelled machinery for forestry - Laboratory tests and performance requirements for roll-over protective structures - General machines《林业用自推进机械 防倾.pdf
  • BS ISO 8082-2-2011 Self-propelled machinery for forestry Laboratory tests and performance requirements for roll-over protective structures Machines having a rotating platf.pdf BS ISO 8082-2-2011 Self-propelled machinery for forestry Laboratory tests and performance requirements for roll-over protective structures Machines having a rotating platf.pdf
  • BS ISO 8083-2006 Machinery for forestry - Falling-object protective structures (FOPS) - Laboratory tests and performance requirements《林业机械 落体防护装置(FOPS) 实验室试验和性能要求》.pdf BS ISO 8083-2006 Machinery for forestry - Falling-object protective structures (FOPS) - Laboratory tests and performance requirements《林业机械 落体防护装置(FOPS) 实验室试验和性能要求》.pdf
  • BS ISO 8086-2004 Dairy plant - Hygiene conditions - General guidance on inspection and sampling procedures《乳品厂 卫生条件 检验和取样程序通用指南》.pdf BS ISO 8086-2004 Dairy plant - Hygiene conditions - General guidance on inspection and sampling procedures《乳品厂 卫生条件 检验和取样程序通用指南》.pdf
  • BS ISO 8096-2005 Rubber- or plastics-coated fabrics for water resistant clothing - Specification《雨衣用橡胶或塑料涂覆织物 规范》.pdf BS ISO 8096-2005 Rubber- or plastics-coated fabrics for water resistant clothing - Specification《雨衣用橡胶或塑料涂覆织物 规范》.pdf
  • BS ISO 8097-2001 Aircraft Minimum airworthiness requirements and test conditions for certified air cargo unit load devices《航空器 经认证的航空货运集装单元装置最低适航性要求和试验条件》.pdf BS ISO 8097-2001 Aircraft Minimum airworthiness requirements and test conditions for certified air cargo unit load devices《航空器 经认证的航空货运集装单元装置最低适航性要求和试验条件》.pdf
  • BS ISO 8114-1993 Textile machinery and accessories - Spindles for ring-spinning and doubling machines - List of equivalent terms《纺织机械和附件 环锭纺纱机和并线机用锭子 同义术语表》.pdf BS ISO 8114-1993 Textile machinery and accessories - Spindles for ring-spinning and doubling machines - List of equivalent terms《纺织机械和附件 环锭纺纱机和并线机用锭子 同义术语表》.pdf
  • 相关搜索

    当前位置:首页 > 标准规范 > 国际标准 > 其他

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1