小编use*_*591的帖子

使用smalltalk编写一个petit解析器,如何使用创建的方法'标识符?

我目前有一个方法

pMain

| parser |  


parser :=  'proc' asParser, #space asParser,  "<---- im trying to use the method identifier here - so i tried self identifier, instead of 'proc' asParser
            #letter asParser plus, $( asParser, 
           'int' asParser,#space asParser, 
           #letter asParser plus, $) asParser, 
           #space asParser, 'corp' asParser.    

   ^ parser
Run Code Online (Sandbox Code Playgroud)

我也有这两种方法

1-关键词方法

keywords
^ keywords ifNil: [
    keywords := Set newFrom: #(
        proc corp
        if then else fi
        do od
        print as
        while
        for from to by
        return
        int string real …
Run Code Online (Sandbox Code Playgroud)

parsing smalltalk pharo petitparser

3
推荐指数
1
解决办法
283
查看次数

标签 统计

parsing ×1

petitparser ×1

pharo ×1

smalltalk ×1