Parse :: ABNF perl的用法 [英] Parse::ABNF perl usage

查看:79
本文介绍了Parse :: ABNF perl的用法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要解析ABIP格式的SIP标头(语法 ),并验证我的Header字符串是否正确.

I need to parse the SIP headers (grammar in ABNF format) and verify if my Header strings are ok or not.

(示例:检查诸如接受:application/sdp,application/3gpp-imp + xml"之类的字符串以提供测试用例通过/失败).

(Example: check strings like "Accept: application/sdp,application/3gpp-imp+xml" to provide testcase pass/fail).

当前,我正在尝试使用perl 解析: :ABNF .现在,我无法理解这种情况下的示例用法.

Currently I am trying to use perl Parse::ABNF. Now I am not able to understand the sample usage in this context.

推荐答案

我的Parse::ABNF模块读取ABNF语法,并允许您访问该语法中的规则.它告诉您诸如"floating-point-number规则引用digit规则"之类的内容,但是它不会为浮点数生成解析器.您可以使用该模块将适当的ABNF语法转换为解析器生成器可以使用的格式,例如Parse::RecDescentMarpa2.这样的转换的示例脚本包含在 eg/abnf2xlx.pl .但是请注意,链接到的页面上的语法与Parse::ABNF所期望的标准格式不完全相同.

My Parse::ABNF module reads ABNF grammars and gives you access to the rules in the grammar. It tells you things like "The floating-point-number rule references the digit rule", but it does not generate a parser for floating point numbers. You can use the module to convert a proper ABNF grammar into a format that can be used by a parser generator like Parse::RecDescent or Marpa2. An example script for such a conversion is included in the distribution as eg/abnf2xlx.pl. Note however that the grammar on the page you link to is not quite the standards-compliant format expected by Parse::ABNF.

这篇关于Parse :: ABNF perl的用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆