欢迎来到麦多课文档分享! | 帮助中心 海量文档,免费浏览,给你所需,享你所想!
麦多课文档分享
全部分类
  • 标准规范>
  • 教学课件>
  • 考试资料>
  • 办公文档>
  • 学术论文>
  • 行业资料>
  • 易语言源码>
  • ImageVerifierCode 换一换
    首页 麦多课文档分享 > 资源分类 > PDF文档下载
    分享到微信 分享到微博 分享到QQ空间

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

    • 资源ID:1257196       资源大小:2MB        全文页数:334页
    • 资源格式: PDF        下载积分:10000积分
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    二维码
    微信扫一扫登录
    下载资源需要10000积分(如需开发票,请勿充值!)
    邮箱/手机:
    温馨提示:
    如需开发票,请勿充值!快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如需开发票,请勿充值!如填写123,账号就是123,密码也是123。
    支付方式: 支付宝扫码支付    微信扫码支付   
    验证码:   换一换

    加入VIP,交流精品资源
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

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

    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 . . . . . . . . . . .


    注意事项

    本文(ISO IEC 30170-2012 Information technology - Programming languages - Ruby《信息技术 编程语言 Ruby》.pdf)为本站会员(deputyduring120)主动上传,麦多课文档分享仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知麦多课文档分享(点击联系客服),我们立即给予删除!




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

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

    收起
    展开