Giter Club home page Giter Club logo

alaparser's People

Contributors

alathon avatar

Stargazers

 avatar

Watchers

 avatar

alaparser's Issues

Preprocessing before commands are run

Right now, if a Command format matches, it is run. This doesn't provide any option to allow the programmer to step in and go, 'But the player isn't the right level!'.

A Command.preprocess(client/C) and Command.postprocess(client/C) is needed, where the return value of preprocess() determines whether the command is run or not.

Likewise, Parser.preprocess() returning FALSE should block running any commands.

The any matcher includes the entire original string

The any matcher currently uses the original, un-cropped input from the client. It should instead turn the current token stream into text separated by a space. This doesn't preserve multiple spaces, but its the best-guess solution that isn't annoyingly hard to work with.

ComponentGenerator.getMatcher()

Currently, ComponentGenerator.getMatcher() is meant to be filled out manually. However, this could be done automatically, by creating all MatcherComponent objects, storing a list of their _name values, and matching against that.

Non-strict option for text and ref matchers

Provide a non-strict option for text and reference-based matchers. The non-strict option will cause matches against text strings to do a 'best-fit' match; if the input is less than the entire text being matched against, that is an acceptable input for that text string.

Example:

If matching input 'lo' against non-strict text literal 'look', the match will return as successful.
If matching input 'lo' against strict text literal 'look', the match will return as unsuccessful, because it is not strictly equal.

Optional option

Implement a ? option that will cause a matcher to be optional.

Alternate component

Allow the pipe(|) operator to act as an 'or' operator in format. Example:

format = "say|talk|speak; any"

Would allow say, talk or speak to work as the first literal. Internally, it should try to match each in turn, and continue once/if one is matched. This probably requires a

Search component

Provide a search component that allows you to reference datums, that may be in a specific location. It should support the following kind of syntax:

"greet; search(mob in loc)"

To greet a mob in the current location.

LocationResolver

A LocationResolver should take in a source and a key, which will determine how the LocationResolver will find and return a list of potential 'sources', which are meant to be matched against by user input. The sources should either be clients, or atoms.

As an example a location key could be 'current_loc', which might return a /room's contents list. The method to match key to list up based on a source, is meant to be overrided, to tailor to the specific game.

Force-value option

The force-value option will cause a MatcherComponent's matched text to become part of the result, whether the type of the component is part of Matcher.getIgnoredValueTypes() or not.

Named references

Provide the ability to do something like this:

format = "get; search(obj@container); ?from; search(obj@contents):container"

To allow 'get sword from bag' and similar. Will require parsing backwards, to resolve the named reference, or something similar.

Another possibility is to resolve all search terms separately and maintain a list of possible matches; then parse forwards again, and check against that.

Surround literals with '

Its not possible to use num, any, search or word as a literal right now. Allow literals to surround with '.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.