我正在尝试使用 flex 和 bison 编写解析器,但我对它的工作原理感到困惑。我正在尝试采用以下方式格式化的文本文件:
Version Header Version 1.00 <--- File always starts with a header
Key : Value <--- Each section includes these but these after the version header are in the "Root" section
==Section Name <--- A section
$Key : Value <--- These are properties
Key : Value <--- Same thing as in the "Root" section
样本格式:
NasuTek Licensing Version 1.00
Vendor : NASUTEKENTERPRISES
Notice : NasuTek Enterprises
License Group : NasuTek Asheila
License Name : NasuTek Asheila
Vendor Notice : NasuTek Asheila Internal Build License
Serial : ASHEL-87267-4987-3737-37821:32742
Start Date : Wed July 04 00:00:00 2012
End Date : Sat July 20 00:00:00 2013
Trial : Yes
Count : 0
Components : EXPORT
Host : Any
==Software Configuration
$Signed Section : Yes
Export Configuration : {
Supports Export to XML : Yes
Supports Export to Text : Yes
}
==Signature
vpUsQJ+Qo4OS+RQg0vuLW0mXjAj/o6v[trunicated]
当我对分组感到困惑时,我该如何做到这一点。我可以让它看到密钥对很简单,但我不知道如何处理使用 == 和 {} 对的拆分?