extended_parser.properties
extended_parser.properties · 7.9 KB
From the archive cmextparser.zip
Download the archive « Back to the archive contents
# Miscellaneous string parser definition file for the English language. # # Copyright (c) 2006, Bo Zimmerman # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the # following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this list of conditions and the following # disclaimer. # # * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # # # This file has one section at the moment: the command processor, which # allows you to parse and manipulate command strings entered by players # before the main coffeemud parser gets ahold of it. # # At the moment, there is only one command defined for each section: # replace "regular expression pattern" with "replacement pattern" # This command will search for the given reguar expression pattern in # the string. If it is found, the string following the with clause # will be used to change the string to something else. Regular # expressions are exactly as they are defined in the Java API. # Replacement expressions may include literals, or a slash followed # by a number to insert Java "capturing groups" from the search # expression. The double quotes around the expressions are required. # You may escape a quote with a backslash to include it in your expressions. # # The command pre-processor has a few extra features for the replace command. One # is that individual command words will be pre-parsed and separated by tabs, which # may be represented in your expressions by the \t character. The replacement # expression may contains \n characters to denote that the command should be # separated into two or more other commands. Be sure to maintain the \t structure # of the string in order for CoffeeMud to properly parse your commands. [command-pre-processor] # first, normalize diff counters with cm counters replace "(.+\t)#(\d+)([a-zA-Z].*)" with "\1\2.\3" replace "(.+\t)([a-zA-Z]+)#(\d+)(.*)" with "\1\3.\2\4" replace "(.+\t)first\t([a-zA-Z].*)" with "\11.\2" replace "(.+\t)second\t([a-zA-Z].*)" with "\12.\2" replace "(.+\t)third\t([a-zA-Z].*)" with "\13.\2" replace "(.+\t)fourth\t([a-zA-Z].*)" with "\14.\2" replace "(.+\t)fifth\t([a-zA-Z].*)" with "\15.\2" replace "(.+\t)sixth\t([a-zA-Z].*)" with "\16.\2" replace "(.+\t)seventh\t([a-zA-Z].*)" with "\17.\2" replace "(.+\t)eighth\t([a-zA-Z].*)" with "\18.\2" replace "(.+\t)ninth\t([a-zA-Z].*)" with "\19.\2" # special match replace "^it\tputs\t(.+)\tin\t(.+)" with "put\t\1\tfrom\t\2" # command word expansions -- this functionality is normally handled by the base parser, # but in this case, we MUST expand the words so that they can match the others # this is also how we can easily define shortcut preferences. replace "^(?>ge|g)\t(.+)" with "get\t\1" replace "^pu\t(.+)" with "put\t\1" replace "^(?>ope|op)\t(.+)" with "open\t\1" replace "^(?>clos|clo|cl)\t(.+)" with "close\t\1" replace "^bu\t(.+)" with "buy\t\1" replace "^ea\t(.+)" with "eat\t\1" replace "^sel\t(.+)" with "sell\t\1" replace "^(?>empt|emp|em)\t(.+)" with "empty\t\1" replace "^(?>unloc|unlo|unl|un)\t(.+)" with "unlock\t\1" replace "^(?>loo|lo|l)\t(.+)" with "look\t\1" replace "^loc\t(.+)" with "lock\t\1" replace "^(?>pul|pu)\t(.+)" with "pull\t\1" replace "^pus\t(.+)" with "push\t\1" replace "^(?>snif|sni)\t(.+)" with "sniff\t\1" replace "^(?>wea|we)\t(.+)" with "wear\t\1" replace "^(?>wiel|wie|wi)\t(.+)" with "wield\t\1" replace "^(?>hol|ho)\t(.+)" with "hold\t\1" # command word separating and normalization replace "^place(\t.+)" with "put\1" replace "^open\tup(\t.+)" with "open\1" replace "^look\tin(\t.+)" with "look\1" replace "^look\tat(\t.+)" with "look\1" replace "^look\tinside(\t.+)" with "look\1" replace "(^(?>get|put|wear|wield|hold|open|close|eat|lock|unlock|pull|push|sniff|buy|sell)\t)(.+\t)and\t((?>hold|open|close|eat|lock)\t)it\tup$" with "\1\2\n\3\2" replace "(^(?>get|put|wear|wield|hold|open|close|eat|lock|unlock|pull|push|sniff|buy|sell)\t)(.+\t)and\t((?>wear|wield|hold|open|close|eat|lock|unlock|pull|push|sniff|buy|sell|read)\t)it$" with "\1\2\n\3\2" replace "(^(?>get|put|wear|wield|hold|open|close|eat|lock|unlock|pull|push|sniff|buy|sell)\t)(.+\t)and\t((?>get|put|wear|wield|hold|open|close|eat|lock|unlock|pull|push|sniff|buy|sell)\t)it(\t.*)" with "\1\2\n\3\2\4" replace "(^(?>get|put|wear|wield|hold|open|close|eat|lock|unlock|pull|push|sniff|buy|sell)\t)(.+\t)and\t((?>get|put|wear|wield|hold|open|close|eat|lock|unlock|pull|push|sniff|buy|sell)\t)(.+)" with "\1\2\n\3\4" replace "^put\t(.+)\tinside\t(.+)" with "put\t\1\tfrom\t\2" replace "^put\t(.+)\tin\t(.+)" with "put\t\1\tfrom\t\2" replace "(^(?>open|close|look)\t)(||.*\t)north($||\t.*)" with "\1north" replace "(^(?>open|close|look)\t)(||.*\t)south($||\t.*)" with "\1south" replace "(^(?>open|close|look)\t)(||.*\t)east($||\t.*)" with "\1east" replace "(^(?>open|close|look)\t)(||.*\t)west($||\t.*)" with "\1west" replace "(^(?>open|close|look)\t)(||.*\t)northwest($||\t.*)" with "\1northwest" replace "(^(?>open|close|look)\t)(||.*\t)southwest($||\t.*)" with "\1southwest" replace "(^(?>open|close|look)\t)(||.*\t)northeast($||\t.*)" with "\1northeast" replace "(^(?>open|close|look)\t)(||.*\t)southeast($||\t.*)" with "\1southeast" # multi-item gets and puts with from replace "(^(?>get|put)\t)(.+),\tand\t(.+\t)(from\t.+)" with "\1\2\t\4\n\1\3\4" replace "(^(?>get|put)\t)(.+),\t(.+)(\tfrom\t.+)" with "\1\2\4\n\1\3\4" replace "(^(?>get|put)\t)(.+\t)and\t(.+\t)(from\t.+)" with "\1\2\4\n\1\3\4" replace "(^(?>get|put)\t)(\d+\..+\t)(\d+\..+\t)(from\t.+)" with "\1\2\4\n\1\3\4" # multi-items without from replace "(^(?>get|put|wear|wield|hold|open|close|eat|lock|unlock|pull|push|sniff|buy|sell)\t)(.+),\tand\t(.+)" with "\1\2\n\1\t\3" replace "(^(?>get|put|wear|wield|hold|open|close|eat|lock|unlock|pull|push|sniff|buy|sell)\t)(.+),\t(.+)" with "\1\2\n\1\3" replace "(^(?>get|put|wear|wield|hold|open|close|eat|lock|unlock|pull|push|sniff|buy|sell)\t)(.+)\tand\t(.+)" with "\1\2\n\1\3" replace "(^(?>wear|wield|hold|open|close|eat|lock|unlock|pull|push|sniff|buy|sell)\t)(\d+\..+\t)(\d+\..+)" with "\1\2\n\1\3" replace "(^(?>get|put)\t)(\d+\..+\t(?<!from\t))(\d+\..+\t(?<!from\t))(\d+\..+)" with "\1\2\n\1\3\n\1\4" # a little final article clean up replace "(^(?>get|put|wear|wield|hold|open|close|eat|lock|unlock|pull|push|sniff|buy|sell|look)\t)the\t(.+)" with "\1\2" replace "(^(?>get|put|wear|wield|hold|open|close|eat|lock|unlock|pull|push|sniff|buy|sell|look)\t)a\t(.+)" with "\1\2" replace "(^(?>get|put|wear|wield|hold|open|close|eat|lock|unlock|pull|push|sniff|buy|sell|look)\t)an\t(.+)" with "\1\2" replace "(^(?>get|put|wear|wield|hold|open|close|eat|lock|unlock|pull|push|sniff|buy|sell|look)\t)that\t(.+)" with "\1\2" replace "(^(?>get|put)\t.+\tfrom\t)the\t(.+)" with "\1\2" replace "(^(?>get|put)\t.+\tfrom\t)a\t(.+)" with "\1\2" replace "(^(?>get|put)\t.+\tfrom\t)an\t(.+)" with "\1\2" replace "(^(?>get|put)\t.+\tfrom\t)that\t(.+)" with "\1\2" [item-pre-processor] [item-fail-processor]