Skip to content

Commit a0cf2b2

Browse files
committed
doc makeKeyword
1 parent 02856c8 commit a0cf2b2

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

M2/Macaulay2/d/actors5.d

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export makeKeywordFun(e:Expr):Expr := (
4141
w:=makeUniqueWord(s.v, parseinfo(prec,bprec,uprec,parsefuns(u,t)));
4242
when globalLookup(w) is x:Symbol do buildErrorPacket("symbol already in use")
4343
else (
44-
install(s.v,w); -- TODO check whether install is really needed (for mathematical symbols as opposed to words)
44+
install(s.v,w); -- install may not be needed (for words as opposed to mathematical symbols) but it doesn't hurt TODO rethink
4545
Expr(makeKeyword(w)))
4646
))
4747
else WrongArg(4,"a boolean")

M2/Macaulay2/d/binding.d

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ special(s:string,f:function(Token,TokenFile,int,bool):ParseTree,lprec:int,rprec:
190190
-- created below are all in the global dictionary.
191191
192192
-- new operators must be:
193-
-- set up as an "actor" with "setup()" -- or not TODO explain
193+
-- set up as an "actor" with "setup()" if they have nonstandard syntax
194+
-- (without "setup()", M2 will just lookup a method)
194195
-- added to the export list in ../m2/exports.m2
195-
-- added to the table binaryOperatorFunctions in ../m2/expressions.m2
196196
-- added to the list of operators in the documentation node "operators" in ../packages/Macaulay2Doc/ov_language.m2
197197
-- documented with a suitable headline, such as:
198198
-- "a unary operator"

M2/Macaulay2/packages/Macaulay2Doc/functions.m2

+1
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ load "./functions/lift-doc.m2"
153153
load "./functions/liftable-doc.m2"
154154
load "./functions/locate-doc.m2"
155155
load "./functions/LU-doc.m2"
156+
load "./functions/makeKeyword-doc.m2"
156157
load "./functions/map-doc.m2"
157158
load "./functions/max-doc.m2"
158159
load "./functions/maxPosition-doc.m2"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--- status: DRAFT
2+
--- author(s): PZJ
3+
--- notes:
4+
5+
doc ///
6+
Key
7+
makeKeyword
8+
(makeKeyword, String)
9+
[makeKeyword, Precedence]
10+
[makeKeyword, Syntax]
11+
Headline
12+
create a new keyword
13+
Usage
14+
makeKeyword s
15+
Inputs
16+
s: String
17+
Precedence => {ZZ,Symbol}
18+
Syntax => {List,Symbol}
19+
Description
20+
Text
21+
Creates a new Keyword out of the input string.
22+
The options specify the parsing behavior of the keyword.
23+
Possible choices for @TT "Syntax"@ are: @TT "Binary"@, @TT "Prefix"@, @TT "Postfix"@ or @TT "{Binary,Prefix}"@.
24+
If @TT "Precedence"@ is a @TT "Symbol"@, the precedence is set to the one of that symbol.
25+
Example
26+
makeKeyword("",Precedence => symbol <)
27+
ZZZZ := (i,j) -> j==i+1
28+
3≺4
29+
///

0 commit comments

Comments
 (0)