modl 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8977139ebfe6769cab1b6b05b6f3a0e15dc4da78e8d323c2cc9f0040a542e39
4
- data.tar.gz: e95a247a77e1e4bc8c728f26c5d27ecffe080209c0c5f3555687cbcd2359ea6e
3
+ metadata.gz: c844f09c9db24781f782a3fe91b477cfaf0e8ed5c62a0487c05eeca3762fa125
4
+ data.tar.gz: 33f723c76c1e976b764407ad81a7d20f555ab1e627f44d1bd8b01935e5e349f1
5
5
  SHA512:
6
- metadata.gz: 92a155e992aa9db13359fdca128018edc70bebb9633f03b7f94644b2b69c03443073cbf88e2d95fc3b8e7bece1224c29c66ffe411e3d5f7ab2059efcb762e0ce
7
- data.tar.gz: c2ce82940bb6aa18bf35bc30e396a3f4a8f4cb7198986ad65135a1ef8298a26eadbe6bc40fbe9c903b0c12426123bb7fd0e222c6417e15d4d85e2e6d33b8784f
6
+ metadata.gz: a3c4499539a206129eab8dec4c60cfcc741488010e4709f708bd88caf1c70fda45cba50198358f634a5dbf1a9399663000c298101686cd2042e7628394a209d8
7
+ data.tar.gz: b487f1b2961fe307aa299a1c57a5517d105030345869348eb93d40e8720cf5b54fe80aefd03b9cb469cfe4b9c6c3d51ceaec18c1c42d85d57277b2432426dabd
data/CHANGELOG.md CHANGED
@@ -1,4 +1,28 @@
1
- # Change Log
2
- Changes are logged here.
3
- ## First Version
4
- Not yet a tagged release.
1
+ 0.3.3
2
+ ===
3
+ - Change module name to MODL from Modl.
4
+ - Support simpler usage, i.e. `x = MODL.parse(str)`. README.md updated accordingly.
5
+ - Ignore *allow and *expect for now, except when used as `x=%*allow` or `x=%*expect`. Proper implementation will follow later.
6
+ - Fixed a NilClass exception.
7
+ - Disabled file caching due to garbage collection and other issues. See issue#1.
8
+ - Grammar update to catch errors from unparsed MODL input.
9
+
10
+ 0.3.2
11
+ ===
12
+ - Update to latest ANTLR4 Runtime
13
+
14
+ 0.3.1
15
+ ===
16
+ - Update to latest ANTLR4 Runtime
17
+
18
+ 0.3.0
19
+ ===
20
+ - First working MODL interpreter for Ruby
21
+
22
+ 0.2.0
23
+ ===
24
+ - Hello world.
25
+
26
+ 0.1.0
27
+ ===
28
+ - Initial release
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Modl::Parser
1
+ # MODL::Parser
2
2
 
3
3
  This Ruby gem can be used as the base for a MODL interpreter. It contains the Lexer, Parser, and other supporting classes generated by the ANTLR4 Ruby language target.
4
4
  ## Installation
@@ -25,13 +25,16 @@ You will also need to install the antlr4-ruby-runtime gem that this depends on.
25
25
  ## Usage
26
26
 
27
27
  ```ruby
28
- require 'modl/interpreter'
28
+ require 'modl'
29
+
30
+ str='s=MODL data'
31
+
32
+ result = MODL.parse(str)
33
+ jsonStr = JSON.pretty_generate(result)
34
+ puts jsonStr
29
35
 
30
- result = Modl::Interpreter.interpret(str)
31
- # or
32
- result = Modl::Interpreter.interpret(str, true)
33
36
  ```
34
- where `str` is the modl to be interpreted. The result will be a JSON string. If the second parameter is `true` then the JSON will be pretty-printed.
37
+ where `str` is the modl to be interpreted.
35
38
 
36
39
  ## Development
37
40
 
@@ -49,4 +52,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
49
52
 
50
53
  ## Code of Conduct
51
54
 
52
- Everyone interacting in the Modl::Parser project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/modl-parser/blob/master/CODE_OF_CONDUCT.md).
55
+ Everyone interacting in the MODL::Parser project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/modl-parser/blob/master/CODE_OF_CONDUCT.md).
@@ -16,7 +16,7 @@
16
16
  {
17
17
  "input": "*L=\"http://modules.num.uk/1.txt\";\n\nclasses=%*class",
18
18
  "minimised_modl": "*L=\"http://modules.num.uk/1.txt\";classes=%*class",
19
- "expected_output": "{\"classes\":\"*class\"}"
19
+ "expected_output": "{\"classes\":[{\"root\":{\"name\":\"root\",\"superclass\":\"arr\",\"*expect\":[\"entity\"]}},{\"object\":{\"name\":\"object\",\"superclass\":\"map\",\"*expect\":[\"i\",\"h\",\"q\",\"c_\",\"r_\",\"tz\"]}},{\"entity\":{\"name\":\"entity\",\"superclass\":\"object\",\"assign\":[[\"n\"],[\"n\",\"q\"]],\"*expect\":[\"n\",\"+\"]}},{\"media\":{\"name\":\"media\",\"superclass\":\"object\",\"assign\":[[\"v\"],[\"d\",\"v\"],[\"d\",\"v\",\"h\"]],\"*expect\":[\"v\",\"ac\"]}},{\"x\":{\"name\":\"extension\",\"superclass\":\"map\",\"*expect\":[\"url\",\"pa\"]}},{\"i\":{\"name\":\"introduction\",\"superclass\":\"str\"}},{\"h\":{\"name\":\"hours\",\"superclass\":\"arr\",\"*expect\":[\"str\"]}},{\"tz\":{\"name\":\"time_zone_city\",\"superclass\":\"str\"}},{\"q\":{\"name\":\"query\",\"superclass\":\"str\"}},{\"c_\":{\"name\":\"continuation_\",\"superclass\":\"str\"}},{\"r_\":{\"name\":\"redirect_\",\"superclass\":\"str\"}},{\"p\":{\"name\":\"person\",\"superclass\":\"entity\",\"*expect\":[\"b\"],\"object_type\":\"entity\",\"object_display_name\":\"Person\"}},{\"o\":{\"name\":\"organisation\",\"superclass\":\"entity\",\"assign\":[[\"n\"],[\"n\",\"+\"],[\"n\",\"s\",\"+\"],[\"?\",\"n\",\"s\",\"+\"],[\"?\",\"n\",\"s\",\"h\",\"+\"]],\"*expect\":[\"s\"],\"object_type\":\"entity\",\"object_display_name\":\"Organisation\",\"description_default\":\"View Organisation\"}},{\"dp\":{\"name\":\"department\",\"superclass\":\"entity\",\"*expect\":[\"d\"],\"object_type\":\"entity\",\"object_display_name\":\"Department\",\"description_default\":\"View Department\"}},{\"e\":{\"name\":\"employee\",\"superclass\":\"entity\",\"assign\":[[\"n\"],[\"n\",\"r\"]],\"*expect\":[\"r\"],\"object_type\":\"entity\",\"object_display_name\":\"Employee\",\"description_default\":\"View Employee\"}},{\"l\":{\"name\":\"location\",\"superclass\":\"entity\",\"*expect\":[\"d\"],\"object_type\":\"entity\",\"object_display_name\":\"Location\"}},{\"f\":{\"name\":\"folder\",\"superclass\":\"entity\",\"*expect\":[\"d\"],\"object_type\":\"entity\",\"object_display_name\":\"Folder\"}},{\"n\":{\"name\":\"name\",\"superclass\":\"str\"}},{\"+\":{\"name\":\"objects\",\"superclass\":\"arr\",\"*expect\":[\"object\"]}},{\"b\":{\"name\":\"bio\",\"superclass\":\"str\"}},{\"s\":{\"name\":\"slogan\",\"superclass\":\"str\"}},{\"d\":{\"name\":\"description\",\"superclass\":\"str\"}},{\"r\":{\"name\":\"role\",\"superclass\":\"str\"}},{\"v\":{\"name\":\"value\",\"superclass\":\"str\"}},{\"ac\":{\"name\":\"access\",\"superclass\":\"arr\",\"*expect\":[\"str\"]}},{\"t\":{\"name\":\"telephone\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Telephone\",\"description_default\":\"Call\",\"prefix\":\"tel://\",\"media_type\":\"core\"}},{\"sm\":{\"name\":\"sms\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"SMS\",\"description_default\":\"Text\",\"prefix\":\"sms://\",\"media_type\":\"core\"}},{\"u\":{\"name\":\"url\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_n\name\":\"URL\",\"description_default\":\"Click\",\"prefix\":\"https://\",\"media_type\":\"core\"}},{\"uu\":{\"name\":\"unsecure_url\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"URL\",\"description_default\":\"Click\",\"prefix\":\"http://\",\"media_type\":\"core\"}},{\"g\":{\"name\":\"gps\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"GPS\",\"description_default\":\"View Address\",\"prefix\":\"Based on user preferences set in client.\",\"media_type\":\"core\"}},{\"a\":{\"name\":\"address\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Address\",\"description_default\":\"View Address\",\"prefix\":\"Based on user preferences set in client.\",\"media_type\":\"core\"}},{\"fx\":{\"name\":\"fax\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Fax\",\"description_default\":\"Send a fax\",\"prefix\":\"Based on user preferences set in client.\",\"media_type\":\"core\"}},{\"em\":{\"name\":\"email\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Email\",\"description_default\":\"Send an email\",\"prefix\":\"mailto://\",\"media_type\":\"core\"}},{\"aa\":{\"name\":\"android-app\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Android App\",\"description_default\":\"Download the app\",\"prefix\":\"https://play.google.com/store/apps/details?id=\",\"media_type\":\"3p\"}},{\"as\":{\"name\":\"ios-app\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"iOS App\",\"description_default\":\"Download the app\",\"prefix\":\"https://itunes.apple.com/app/\",\"media_type\":\"3p\"}},{\"bt\":{\"name\":\"baidu_tieba\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Baidu Tieba\",\"description_default\":\"View Baidu profile\",\"prefix\":\"https://tieba.baidu.com/\",\"media_type\":\"3p\"}},{\"fb\":{\"name\":\"facebook\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Facebook\",\"description_default\":\"View Facebook profile\",\"prefix\":\"https://www.facebook.com/\",\"media_type\":\"3p\"}},{\"fk\":{\"name\":\"flikr\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Flikr\",\"description_default\":\"View Flikr profile\",\"prefix\":\"https://www.flikr.com/\",\"media_type\":\"3p\"}},{\"fs\":{\"name\":\"foursquare\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"FourSquare\",\"description_default\":\"View FourSquare page\",\"prefix\":\"https://www.foursquare.com/\",\"media_type\":\"3p\"}},{\"ft\":{\"name\":\"facetime\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"FaceTime\",\"description_default\":\"Call with FaceTime\",\"prefix\":\"facetime://\",\"media_type\":\"3p\"}},{\"gp\":{\"name\":\"google-plus\",\"superc\nlass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Google Plus\",\"description_default\":\"View Google Plus profile\",\"prefix\":\"https://plus.google.com/\",\"media_type\":\"3p\",\"value_prefix\":\"+\"}},{\"im\":{\"name\":\"imessage\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"iMessage\",\"description_default\":\"Send iMessage\",\"prefix\":\"imessage://\",\"media_type\":\"3p\"}},{\"in\":{\"name\":\"instagram\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Instagram\",\"description_default\":\"View Instagram profile\",\"prefix\":\"https://www.instagram.com/\",\"media_type\":\"3p\"}},{\"kk\":{\"name\":\"kik\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Kik\",\"description_default\":\"Connect with Kik\",\"prefix\":\"https://www.kik.com/u/\",\"media_type\":\"3p\"}},{\"li\":{\"name\":\"linkedin\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"LinkedIn\",\"description_default\":\"View LinkedIn page\",\"prefix\":\"https://www.linkedin.com/\",\"media_type\":\"3p\"}},{\"ln\":{\"name\":\"line\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"LINE\",\"description_default\":\"Connect with Line\",\"prefix\":\"line://\",\"media_type\":\"3p\"}},{\"md\":{\"name\":\"medium\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Medium\",\"description_default\":\"View Medium blog\",\"prefix\":\"https://www.medium.com/\",\"media_type\":\"3p\"}},{\"pr\":{\"name\":\"periscope\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Periscope\",\"description_default\":\"View Periscope profile\",\"prefix\":\"https://www.periscope.tv/\",\"media_type\":\"3p/\"}},{\"pi\":{\"name\":\"pinterest\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Pinterest\",\"description_default\":\"View Pinterest board\",\"prefix\":\"https://www.pinterest.com/\",\"media_type\":\"3p\"}},{\"qq\":{\"name\":\"qq\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"QQ\",\"description_default\":\"View QQ Page\",\"prefix\":\"https://www.qq.com/\",\"media_type\":\"3p\"}},{\"qz\":{\"name\":\"qzone\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Qzone\",\"description_default\":\"View Qzone page\",\"prefix\":\"https://www.qzone.com/\",\"media_type\":\"3p\"}},{\"rd\":{\"name\":\"reddit\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Reddit\",\"description_default\":\"View subreddit\",\"prefix\":\"https://www.reddit.com/r/\",\"media_type\":\"3p\"}},{\"rn\":{\"name\":\"renren\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Renren\",\"description_default\":\"View Renren profile\",\"prefix\":\"https://www.renren.com/\",\"media_type\n\":\"3p\"}},{\"sc\":{\"name\":\"soundcloud\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"SoundCloud\",\"description_default\":\"View SoundCloud page\",\"prefix\":\"https://www.soundcloud.com/\",\"media_type\":\"3p\"}},{\"sk\":{\"name\":\"skype\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Skype\",\"description_default\":\"Call with Skype\",\"prefix\":\"skype://\",\"media_type\":\"3p\"}},{\"sr\":{\"name\":\"swarm\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Swarm\",\"description_default\":\"Connect with Swarm\",\"prefix\":\"https://www.swarmapp.com/\",\"media_type\":\"3p\"}},{\"sn\":{\"name\":\"snapchat\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Snapchat\",\"description_default\":\"Connect with Snapchat\",\"prefix\":\"snapchat://add/\",\"media_type\":\"3p\"}},{\"sw\":{\"name\":\"sina-weibo\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Sina Weibo\",\"description_default\":\"View Weibo page\",\"prefix\":\"https://www.weibo.com/\",\"media_type\":\"3p\"}},{\"tb\":{\"name\":\"tumblr\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Tumblr\",\"description_default\":\"View Tumblr blog\",\"prefix\":\"https://<val>.tumblr.com/\",\"media_type\":\"3p\"}},{\"tl\":{\"name\":\"telegram\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Telegram\",\"description_default\":\"Connect with Telegram\",\"prefix\":\"https://www.telegram.me/\",\"media_type\":\"3p\"}},{\"tw\":{\"name\":\"twitter\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Twitter\",\"description_default\":\"View Twitter profile\",\"prefix\":\"https://www.twitter.com/\",\"media_type\":\"3p\",\"value_prefix\":\"@\"}},{\"to\":{\"name\":\"twoo\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Twoo\",\"description_default\":\"View Twoo page\",\"prefix\":\"https://www.twoo.com/\",\"media_type\":\"3p\"}},{\"vb\":{\"name\":\"viber\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Viber\",\"description_default\":\"Call with Viber\",\"prefix\":\"https://www.viber.com/\",\"media_type\":\"3p\"}},{\"vk\":{\"name\":\"vkontakte\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Vkontakte\",\"description_default\":\"View VK page\",\"prefix\":\"https://www.vk.com/\",\"media_type\":\"3p\"}},{\"vm\":{\"name\":\"vimeo\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Vimeo\",\"description_default\":\"View Vimeo profile\",\"prefix\":\"https://www.vimeo.com/\",\"media_type\":\"3p\"}},{\"wa\":{\"name\":\"whatsapp\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Whatsapp\",\"description_default\":\"Message on Whatsapp\",\n\"prefix\":\"whatsapp://\",\"media_type\":\"3p\"}},{\"wc\":{\"name\":\"wechat\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"WeChat\",\"description_default\":\"Connect with WeChat\",\"prefix\":\"https://www.wechat.com/\",\"media_type\":\"3p\"}},{\"xi\":{\"name\":\"xing\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"Xing\",\"description_default\":\"View Xing page\",\"prefix\":\"https://www.xing.com/\",\"media_type\":\"3p\"}},{\"yt\":{\"name\":\"youtube\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"YouTube\",\"description_default\":\"View YouTube channel\",\"prefix\":\"https://www.youtube.com/\",\"media_type\":\"3p\"}},{\"yy\":{\"name\":\"yy\",\"superclass\":\"media\",\"object_type\":\"media\",\"object_display_name\":\"YY\",\"description_default\":\"View YY page\",\"prefix\":\"https://www.yy.com/\",\"media_type\":\"3p\"}}]}"
20
20
  },
21
21
  {
22
22
  "input": "*method(\n ## The method can be called by it's ID or name\n *id=cn;\n *name=company_name;\n ## The value of the object that the method is called on is transformed using the following methods:\n *transform=`replace(-, ).trim(.).initcap`\n);\n\nm=%*method",