我想在dired或类似dired的缓冲区中运行解压缩(甚至zip).有这样的事吗?我想要与Nautilus文件管理器类似的东西:即,选择文件,然后按一下键击以将这些文件放入新的存档文件中.
谢谢
是否有更简单的方法来解析1行注释?
comment
^ '//' asParser ,
(#any asParser starLazy: (#newline asParser)) ,
#newline asParser
==> [ :result | nil "Ignore comments" ]
program
^ (comment / instruction) star
==> [ :result | N2TProgramNode new
setNodes: (result copyWithout: nil) ]
Run Code Online (Sandbox Code Playgroud)
我特别不确定(#newline asParser)和#copyWithout:的重复.
在Lukas的回答之后,我提出了更简单的以下解决方案:
program
^ programEntity star
==> [ :result | N2TProgramNode new setNodes: result]
programEntity
^ instruction trim: ignorable
ignorable
^ comment / #space asParser
comment
^ '//' asParser , #newline asParser negate star
Run Code Online (Sandbox Code Playgroud) 在Pharo中,我想定义一个ConfigurationOfNand2Tetris只包含一个包的Metacello :
ConfigurationOfNand2Tetris>>baseline01: spec
<version: '0.1-baseline'>
spec
for: #common
do: [
spec
blessing: #baseline;
repository: 'http://www.smalltalkhub.com/mc/DamienCassou/Nand2Tetris/main';
package: 'Nand2Tetris' ]
ConfigurationOfNand2Tetris>>development: spec
<symbolicVersion: #development>
spec for: #common version: '0.1-baseline'.
Run Code Online (Sandbox Code Playgroud)
当我执行时,MetacelloToolBox validateConfiguration: ConfigurationOfNand2Tetris我总是得到2个警告:
在http://pharobooks.gforge.inria.fr/PharoByExampleTwo-Eng/latest/中,定义了ExpressionGrammar.但是,它是正确联想的
parser parse: '1 + 2 + 6'. ======> #(1 $+ #(2 $+ 6))
Run Code Online (Sandbox Code Playgroud)
我怎样才能使它成为左关联的呢
parser parse: '1 + 2 + 6'.
Run Code Online (Sandbox Code Playgroud)
结果是
#(#(1 $+ 2) $+ 6)
Run Code Online (Sandbox Code Playgroud)
?
我不明白以下摘录.更确切地说,目前还不清楚该#includes:指令是什么,因为它看起来与其相反#requires:.
spec for: #'pharo3.x' do: [
spec
package: 'Grease-Core' with: [
spec includes: #('Grease-Pharo30-Core' ). ];
package: 'Grease-Tests-Core' with: [
spec includes: #('Grease-Tests-Pharo20-Core' ). ];
package: 'Grease-Pharo30-Core' with: [
spec requires: #('Grease-Core' ). ];
package: 'Grease-Tests-Pharo20-Core' with: [
spec requires: #('Grease-Tests-Core' ) ] ].
Run Code Online (Sandbox Code Playgroud) 我想要一个只识别0到32767之间的数字的解析规则.我尝试过类似的东西:
integerConstant
^ (#digit asParser min: 1 max: 5) flatten
==> [ :string | | value |
value := string asNumber.
(value between: 0 and: 32767)
ifTrue: [ value ]
ifFalse: [ **???** ]]
Run Code Online (Sandbox Code Playgroud)
但我不知道该怎么写??? 我想过返回一个PPFailure,但这需要知道流的位置.