Ruby:syntax error, unexpected keyword_end, expecting '<' or ';' or '\n'
2013-04-17 07:28
309 查看
在WIN7下,一段简单的代码:
class Person
end
执行,竟然会报错:
test.rb:1: syntax error, unexpected keyword_end, expecting '<' or ';' or '\n'
endss Person
百思不得其解,最后怀疑到换行符上,查看带行尾的格式如下:
如果是WIN平台上,换行符应该是\r\n的,Unix下应该是\n,但这里不知为什么文件会默认使用\r……
class Person
end
执行,竟然会报错:
test.rb:1: syntax error, unexpected keyword_end, expecting '<' or ';' or '\n'
endss Person
百思不得其解,最后怀疑到换行符上,查看带行尾的格式如下:
如果是WIN平台上,换行符应该是\r\n的,Unix下应该是\n,但这里不知为什么文件会默认使用\r……
相关文章推荐
- ModelSim错误:syntax error, unexpected "IDENTIFIER", expecting ".*" or '.'
- syntax error, unexpected ''&expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NU
- thinkphp syntax error, unexpected ')', expecting T_VARIABLE or '$'
- textcolor 设置selecter 报错: <item> tag requires a 'color' attribute or child tag defining a drawab
- rake aborted! undefined local variable or method `version_requirements' for #<Rails::GemDependency:0
- error C2253: 'RefCounted<T>' : pure specifier or abstract override specifier only allowed on virtual
- error C2143: syntax error : missing ';' before '<class-head>'
- error MIDL2025 : syntax error : expecting ] or , near "annotation"
- error C2679: binary '<<' : no operator defined which takes a right-hand operand of type '' (or there is no acceptable conversion
- error MIDL2025 : syntax error : expecting ] or , near "annotation"
- FAILED: ParseException line mismatched input '<EOF>' expecting StringLiteral near 'by' in
- supervisorctl报错"error: <class 'socket.gaierror'>, [Errno -2] Name or service not known"的解决方法
- android背景设置报错 <item> tag requires a 'drawable' attribute or child tag defining a drawable
- yii框架中建立表单请问错在哪Parse error: syntax error, unexpected '=', expecting ')' in E:\WEB\yii-1.1.8.r3324\pr
- 'init(start:end:)' is deprecated: it will be removed in Swift 3. Use the '..<' operator
- proguard.ParseException: Expecting keyword 'class', 'interface', or 'enum' before '-libraryjars' in
- Error: Expecting keyword 'class', 'interface', or 'enum' before '-optimizationpasses' in line 11 of
- linux shell中的$0,$?,$!和<<'END'
- linux shell中间$0,$?,$!和<<'END'
- &lt;?php}?&gt;格式导致错误 Parse error: syntax error, unexpected end of file in *.php on line 374