modl 0.3.3 → 0.3.4

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: c844f09c9db24781f782a3fe91b477cfaf0e8ed5c62a0487c05eeca3762fa125
4
- data.tar.gz: 33f723c76c1e976b764407ad81a7d20f555ab1e627f44d1bd8b01935e5e349f1
3
+ metadata.gz: 54f3321cf2f6325e99bae9efc3cfb8630ff764ff68e8b12378a517dcf60edc10
4
+ data.tar.gz: ed2c4999d2e0d2abd71f2fe11b377594ba8356e9a2b9a8f42e61c6af911e0f84
5
5
  SHA512:
6
- metadata.gz: a3c4499539a206129eab8dec4c60cfcc741488010e4709f708bd88caf1c70fda45cba50198358f634a5dbf1a9399663000c298101686cd2042e7628394a209d8
7
- data.tar.gz: b487f1b2961fe307aa299a1c57a5517d105030345869348eb93d40e8720cf5b54fe80aefd03b9cb469cfe4b9c6c3d51ceaec18c1c42d85d57277b2432426dabd
6
+ metadata.gz: aa50e7a3e4e54ed5310363b196e27d154ea8d6691e12c1a0a29d4d946a32602cabc8219293b2e7ff7dfbdc2c49e6b5bcd77b0b27aedc83c157fcffa137724bb1
7
+ data.tar.gz: 9e5e8f8ae9634da50f48b64710864c2aa55c1f51b819943d2f646f788c07a7418b2b375569a3743f9e22edd86d85c6afe57bd87a577d5500e2c715414dd11c6c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ 0.3.4
2
+ ===
3
+ - Fixed a bug with class handling to expand classes properly.
4
+ - Add `*expect` to the output for the `%*class` instruction.
5
+
1
6
  0.3.3
2
7
  ===
3
8
  - Change module name to MODL from Modl.
@@ -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\":[{\"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\"}}]}"
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_name\":\"URL\",\"de\nscription_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\",\"superclass\":\"media\",\n\"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\":\"3p\"}},{\"sc\"\n:{\"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\",\"prefix\":\"what\nsapp://\",\"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",
@@ -47,6 +47,8 @@ module MODL
47
47
 
48
48
  if v.is_a?(Array)
49
49
  new_value = v if new_value.empty?
50
+ elsif v.is_a?(String)
51
+ # Safe to ignore
50
52
  else
51
53
  # Check the top class and do some type-specific processing
52
54
  tc = top_class(clazz, global)
@@ -95,24 +97,29 @@ module MODL
95
97
 
96
98
  # If the new_value has nested class references then process those recursively as well.
97
99
  def self.process_nested_classes(global, new_value)
98
- return unless new_value.is_a? Hash
100
+ if new_value.is_a?(Hash)
99
101
 
100
- new_value.keys.each do |nk|
101
- clazz = global.classs(nk)
102
- nv = new_value[nk]
103
- next unless clazz # skip it if it doesn't refer to a class
102
+ new_value.keys.each do |nk|
103
+ clazz = global.classs(nk)
104
+ nv = new_value[nk]
105
+ next unless clazz # skip it if it doesn't refer to a class
104
106
 
105
- if !nv.nil? && !nv.is_a?(String) && !nv.is_a?(Numeric)
106
- new_k, new_v = process_class global, nk, nv
107
- else
108
- new_k = clazz.name_or_id
109
- new_v = nv
110
- end
107
+ if !nv.nil? && !nv.is_a?(String) && !nv.is_a?(Numeric)
108
+ new_k, new_v = process_class global, nk, nv
109
+ else
110
+ new_k = clazz.name_or_id
111
+ new_v = nv
112
+ end
111
113
 
112
- # Replace the value for this key if we've changed anything.
113
- if new_value[new_k] != new_v
114
- new_value.delete nk
115
- new_value[new_k] = new_v
114
+ # Replace the value for this key if we've changed anything.
115
+ if new_value[new_k] != new_v
116
+ new_value.delete nk
117
+ new_value[new_k] = new_v
118
+ end
119
+ end
120
+ elsif new_value.is_a?(Array)
121
+ new_value.each do |nk|
122
+ process_nested_classes(global, nk)
116
123
  end
117
124
  end
118
125
  end
@@ -124,12 +131,12 @@ module MODL
124
131
 
125
132
  # Process the key list if we found one otherwise raise an error
126
133
  # Slightly different processing for hashes and arrays
127
- if v.is_a? Hash
128
- keys = clazz.keylist_of_length(v.length)
129
- lam = ->(i) {v[v.keys[i]]}
130
- elsif v.is_a? Array
131
- keys = clazz.keylist_of_length(v.length)
134
+ if v.is_a? Array
135
+ keys = key_list(global, clazz, v.length)
132
136
  lam = ->(i) {v[i]}
137
+ elsif !v.is_a?(Hash)
138
+ keys = key_list(global, clazz, 1)
139
+ lam = ->(i) {v}
133
140
  end
134
141
 
135
142
  keys&.each_index do |i|
@@ -143,6 +150,17 @@ module MODL
143
150
  clazz.merge_content(new_value)
144
151
  end
145
152
 
153
+ def self.key_list(global, clazz, len)
154
+ list = clazz.keylist_of_length(len)
155
+ return list if !list.nil? && list.length > 0
156
+ superclass = global.classs(clazz.superclass)
157
+ if superclass.nil?
158
+ raise InterpreterError,
159
+ 'No key list of the correct length in class ' + clazz.name_or_id + ' - looking for one of length ' + len.to_s
160
+ end
161
+ key_list(global, superclass, len)
162
+ end
163
+
146
164
  # Get the top level class for the supplied class
147
165
  def self.top_class(clazz, global, depth = 0)
148
166
  # Check for self-referential classes that cause infinite recursion
@@ -210,6 +210,11 @@ module MODL
210
210
  map['allow'] = clazz.allow.extract_hash
211
211
  end
212
212
 
213
+ # expect
214
+ if clazz.expect
215
+ map['expect'] = clazz.expect.extract_hash
216
+ end
217
+
213
218
  # content
214
219
  if clazz.content.length.positive?
215
220
  clazz.content.each do |item|
@@ -8,6 +8,7 @@ module MODL
8
8
  attr_accessor :assign
9
9
  attr_accessor :content
10
10
  attr_accessor :allow
11
+ attr_accessor :expect
11
12
 
12
13
  def initialize
13
14
  @content = {}
@@ -15,7 +16,7 @@ module MODL
15
16
 
16
17
  # Find a keylist of the right length from the *assign array of arrays.
17
18
  def keylist_of_length(len)
18
- return [] if @assign.nil?
19
+ return nil if @assign.nil?
19
20
 
20
21
  @assign.each do |kl|
21
22
  return kl if kl.length == len
@@ -67,6 +68,9 @@ module MODL
67
68
  when 'allow'
68
69
  clazz.allow = item.pair.array if item.pair.array
69
70
  clazz.allow = item.pair.valueItem.value.array if item.pair.valueItem.value.array
71
+ when 'expect'
72
+ clazz.expect = item.pair.array if item.pair.array
73
+ clazz.expect = item.pair.valueItem.value.array if item.pair.valueItem.value.array
70
74
  else
71
75
  clazz.content[item.pair.key] = item.pair.array if item.pair.array
72
76
  clazz.content[item.pair.key] = item.pair.map if item.pair.map
@@ -1,5 +1,5 @@
1
1
  module MODL
2
2
  module Parser
3
- VERSION = "0.3.3"
3
+ VERSION = "0.3.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Walmsley