2
我想在Objective-C中使用ParseKit開發一個UCI解析器,但我需要一種方法來匹配從文字到行尾的所有內容(可能會減去尾隨空格)。如何在ParseKit中匹配從文字到行尾的所有內容?
例如,我想分析該行:
@" id name Protector 1.4.0 Linux \n"
我的語法是這樣的:
@start = sentence+;
sentence = 'id' 'name' name;
name = Any+;
和
- (void)didMatchName:(PKAssembly *)a
{
NSLog(@"%@", a);
}
明顯版畫:
[id, name, Protector, 1.4, .0]id/name/Protector/1.4/.0^Linux
[id, name, Protector]id/name/Protector^1.4/.0/Linux
[id, name, Protector, 1.4, .0, Linux]id/name/Protector/1.4/.0/Linux^
[id, name, Protector, 1.4]id/name/Protector/1.4^.0/Linux
我該如何構造一個以這種方式標記字符串的語法?
[id, name, Protector 1.4.0 Linux]id/name/Protector 1.4.0 Linux^