summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Command/CommonCommands.hs
AgeCommit message (Collapse)Author
2021-07-06remove redundant optionsMeowyam
2021-07-06resolves GrammaticalFramework/gf-core/#97, without lMeowyam
2021-07-02resolves GrammaticalFramework/gf-core/#97Meowyam
2018-09-21option rf -paragraphsAarne Ranta
2017-09-04eliminate modules PGF.Lexing, PGF.LexingAGreek. Make PGF.Utilities an ↵Krasimir Angelov
internal module in the runtime. These are not really part of the core runtime.
2016-04-07GF shell: fix a parsing problem with the cc commandhallgren
This patch fixes a problem introduced last year when the GF shell was refactored to allow more commands to be treated uniformly and be part of pipes. The cc command was one of those commands, but unfortunately this introduced a parsing problem, e.g. > cc "last" constant not found: last > cc "last"++"year" command not parsed: cc "last"++"year" This happened because the generic command line parser in GF.Command.{Abstract,Parse} assumes that all commands have an argument of type PGF.Expr. Commands that expect other types of arguments have to use PGF.showExpr combined with other conversion to the argument type they expect. The cc command excpets a GF.Grammar.Term, and unfortunately not all terms survice the roundtrip through PGF.Expr, in part because of an additional hack to allow strings to be roundtripped through PGF.Expr without adding superfluous double quotes. To solve the problem, this patch + makes room for arguments of type Term in the Argument type in GF.Command.Abstract. + makes a special case for the cc command in GF.Command.Parse, by calling the partial parser 'runPartial pTerm' recently added in GF.Grammar.Lexer and GF.Grammar.Parser. Care was taken so that that "|" and ";" can be used both inside terms and as separators between commands in the shell, e.g. things like the following now work: > cc ("a"|"b") | ps -lexcode variants { "a" ; "b" } + introduces a type CommandArgument that replaces [Expr] as the type of values passed between commands in pipes. It has room for values of type [Expr], [String] and Term, thus eliminating the need to roundtrip through the Expr type all the time. The hack to avoid adding superfluous quotes when strings are roundtripped through Expr has been left in place for now, but can probably be removed.
2016-02-23add lexer and unlexer for Ancient Greek accent normalizationleiss
2015-09-03GF shell: write_file now writes one tree per linehallgren
This compensates for other changes that removed line breaks. Maybe it should have a -lines options like ps and rf?
2015-08-18GF shell: restore the eh command to working order and document ithallgren
Also, when the command line parser fails, append the problematic command line to the error message "command not parsed".
2015-08-13GF Shell: refactoring for improved modularity and reusability:hallgren
+ Generalize the CommandInfo type by parameterizing it on the monad instead of just the environment. + Generalize the commands defined in GF.Command.{Commands,Commands2,CommonCommands,SourceCommands,HelpCommand} to work in any monad that supports the needed operations. + Liberate GF.Command.Interpreter from the IO monad. Also, move the current PGF from CommandEnv to GFEnv in GF.Interactive, making the command interpreter even more generic. + Use a state monad to maintain the state of the interpreter in GF.{Interactive,Interactive2}.
2015-08-12GF Shell: turn set_encoding into a common commandhallgren
Implemented in GF.Command.CommonCommands instead of GF.Interactive & GF.Interactive2.
2015-08-10Factor out common code from GF.Command.Commands and GF.Command.Commands2hallgren
Created module GF.Command.CommonCommands with ~250 lines of code for commands that do not depend on the type of PGF in the environemnt, either because they don't use the PGF or because they are just documented here and implemented elsewhere. TODO: further refactoring so that documentation and implementation of *all* commands can be kept together.