Skip to content

Commit

Permalink
doc makeKeyword
Browse files Browse the repository at this point in the history
  • Loading branch information
pzinn committed Dec 3, 2024
1 parent c0327d5 commit 0fc2823
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
4 changes: 2 additions & 2 deletions M2/Macaulay2/d/binding.d
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ special(s:string,f:function(Token,TokenFile,int,bool):ParseTree,lprec:int,rprec:
-- created below are all in the global dictionary.

-- new operators must be:
-- set up as an "actor" with "setup()" -- or not TODO explain
-- set up as an "actor" with "setup()" if they have nonstandard syntax
-- (without "setup()", M2 will just lookup a method)
-- added to the export list in ../m2/exports.m2
-- added to the table binaryOperatorFunctions in ../m2/expressions.m2
-- added to the list of operators in the documentation node "operators" in ../packages/Macaulay2Doc/ov_language.m2
-- documented with a suitable headline, such as:
-- "a unary operator"
Expand Down
1 change: 1 addition & 0 deletions M2/Macaulay2/packages/Macaulay2Doc/functions.m2
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ load "./functions/lift-doc.m2"
load "./functions/liftable-doc.m2"
load "./functions/locate-doc.m2"
load "./functions/LU-doc.m2"
load "./functions/makeKeyword-doc.m2"
load "./functions/map-doc.m2"
load "./functions/max-doc.m2"
load "./functions/maxPosition-doc.m2"
Expand Down
29 changes: 29 additions & 0 deletions M2/Macaulay2/packages/Macaulay2Doc/functions/makeKeyword-doc.m2
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--- status: DRAFT
--- author(s): PZJ
--- notes:

doc ///
Key
makeKeyword
(makeKeyword, String)
[makeKeyword, Precedence]
[makeKeyword, Syntax]
Headline
create a new keyword
Usage
makeKeyword s
Inputs
s: String
Precedence => {ZZ,Symbol}
Syntax => {List,Symbol}
Description
Text
Creates a new Keyword out of the input string.
The options specify the parsing behavior of the keyword.
Possible choices for @TT "Syntax"@ are: @TT "Binary"@, @TT "Prefix"@, @TT "Postfix"@ or @TT "{Binary,Prefix}"@.
If @TT "Precedence"@ is a @TT "Symbol"@, the precedence is set to the one of that symbol.
Example
makeKeyword("",Precedence => symbol <)
ZZZZ := (i,j) -> j==i+1
3≺4
///

0 comments on commit 0fc2823

Please sign in to comment.