SyntaxInformation

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

DetailsDetails

  • 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}.

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Specify that f should take exactly two arguments:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input

Set up options for f:

In[1]:=
Click for copyable input

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

In[2]:=
Click for copyable input

Inappropriate options are colored red:

In[3]:=
Click for copyable input
Introduced in 2007
(6.0)