SyntaxInformation

SyntaxInformation[f]

gives information used to generate syntax coloring and other advisories when f[] is entered as input.

Details

  • SyntaxInformation[f]={"prop1"->data1,"prop2"->data2,} defines syntax properties propi for f.
  • Possible properties include:
  • "ArgumentsPattern"patterns for the sequence of allowed arguments
    "LocalVariables"type and allowed positions of local variables
    "ColorEqualSigns"argument positions for which = should be colored
  • The setting for "ArgumentsPattern" is of the form {patt1,patt2,}, where the patti can be _, __, ___, _., OptionsPattern[], or {p1,}.
  • If the setting for "ArgumentsPattern" specifies that f takes options, then valid option names are determined from Options[f].
  • The setting for "LocalVariables" is of the form {"type",{imin,imax}}. Possible types include "Table", "Solve", "Integrate", "Limit", "Plot", "Manipulate". imin and imax give the minimum and maximum argument positions at which the variables can appear. imax can be Infinity.
  • A setting for "LocalVariables" of {"type",{imin,imax},"Lexical"} specifies that local variables that appear inside Dynamic should not be specially colored.
  • The setting for "ColorEqualSigns" is of the form {imin,imax}.

Examples

open allclose all

Basic Examples  (2)

Specify that f should take exactly two arguments:

Set up options for f:

Specify that f should have two arguments, followed by options:

Inappropriate options are colored red:

Scope  (4)

The first argument of f should be a list of exactly two elements:

The first argument is allowed to be an expression such as a symbol, which could evaluate to a list:

f can have any number of arguments, but each should be a two-element list:

f should allow "Table-like" local iterator specifications at positions 2 through infinity:

f should have one ordinary argument, followed by iterator-type list arguments:

Wolfram Research (2007), SyntaxInformation, Wolfram Language function, https://reference.wolfram.com/language/ref/SyntaxInformation.html.

Text

Wolfram Research (2007), SyntaxInformation, Wolfram Language function, https://reference.wolfram.com/language/ref/SyntaxInformation.html.

CMS

Wolfram Language. 2007. "SyntaxInformation." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SyntaxInformation.html.

APA

Wolfram Language. (2007). SyntaxInformation. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SyntaxInformation.html

BibTeX

@misc{reference.wolfram_2024_syntaxinformation, author="Wolfram Research", title="{SyntaxInformation}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/SyntaxInformation.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_syntaxinformation, organization={Wolfram Research}, title={SyntaxInformation}, year={2007}, url={https://reference.wolfram.com/language/ref/SyntaxInformation.html}, note=[Accessed: 22-November-2024 ]}