mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
108 lines
4.7 KiB
Plaintext
108 lines
4.7 KiB
Plaintext
|
|
||
|
Title: Language Notes
|
||
|
_______________________________________________________________________________
|
||
|
|
||
|
This is more for my personal reference than anything else.
|
||
|
|
||
|
|
||
|
___________________________________________________________________________
|
||
|
|
||
|
Topic: Prototype Parameter Styles
|
||
|
___________________________________________________________________________
|
||
|
|
||
|
Parameters via Commas, Typed via Spaces:
|
||
|
|
||
|
> FunctionName ( type indentifier, type identifier = value, modifier type identifier )
|
||
|
> FunctionName ( indentifier, identifier = value )
|
||
|
|
||
|
The general idea is that parameters are separated by commas. Identifiers cannot contain spaces. Types and modifiers,
|
||
|
if available, are separated from the identifiers with spaces. There may be an equals sign to set the default value.
|
||
|
|
||
|
So parsing means splitting by commas, stripping everything past an equals sign for the default value, stripping everything
|
||
|
after the last space for the identifier, and the rest is the type. If there are no internal spaces after the default value is
|
||
|
stripped, it's all identifier.
|
||
|
|
||
|
Note that internal parenthesis, brackets, braces, and angle brackets should be parsed out. They may be present in default
|
||
|
values or types and any commas and equal signs in them should not be included.
|
||
|
|
||
|
Applies to C++, Java, C#, JavaScript, Python, PHP, Ruby.
|
||
|
|
||
|
Applies to Perl as well, even though it doesn't have any real parameter declaration structure. Just adding it with comments
|
||
|
is fine.
|
||
|
|
||
|
Parameters via Semicolons and Commas, Typed via Colons:
|
||
|
|
||
|
> FunctionName ( identifier: type; identifier, identifier: type; identifier: type := value )
|
||
|
|
||
|
Parameters via semicolons, types via colons. However, there can be more than one parameter per type via commas.
|
||
|
Default values via colon-equals.
|
||
|
|
||
|
Applies to Pascal, Ada.
|
||
|
|
||
|
|
||
|
SQL:
|
||
|
|
||
|
> FunctionName ( identifier type, identifier modifier type, identifier type := value )
|
||
|
|
||
|
Parameters separated by commas. Identifiers come before the types and are separated by a space. Default values are
|
||
|
specified with colon-equals.
|
||
|
|
||
|
> FunctionName @identifier type, @dentifier modifier type, @identifier type = value
|
||
|
|
||
|
Microsoft's SQL uses equals instead of colon-equals, doesn't need parenthesis, and starts its parameter names with an @
|
||
|
symbol.
|
||
|
|
||
|
|
||
|
Visual Basic:
|
||
|
|
||
|
> FunctionName ( modifiers identifier as type, identifier = value )
|
||
|
|
||
|
Parameters separated by commas. Default values via equals. However, any number of modifiers may appear before the
|
||
|
identifier. Those modifiers are ByVal, ByRef, Optional, and ParamArray.
|
||
|
|
||
|
|
||
|
Tcl:
|
||
|
|
||
|
> FunctionName { identifier identifier { whatever } } { code }
|
||
|
|
||
|
Identifiers are specified in the first set of braces and have no commas. However, they can be broken out into sub-braces.
|
||
|
|
||
|
|
||
|
___________________________________________________________________________
|
||
|
|
||
|
Topic: Syntax References
|
||
|
___________________________________________________________________________
|
||
|
|
||
|
C++ - http://www.csci.csusb.edu/dick/c++std/syntax.html
|
||
|
|
||
|
C# - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csspec/html/CSharpSpecStart.asp. Open in IE.
|
||
|
|
||
|
Java - http://cui.unige.ch/db-research/Enseignement/analyseinfo/
|
||
|
Ada - http://cui.unige.ch/db-research/Enseignement/analyseinfo/
|
||
|
|
||
|
SQL - http://cui.unige.ch/db-research/Enseignement/analyseinfo/,
|
||
|
<http://www.cs.umb.edu/cs634/ora9idocs/appdev.920/a96624/13_elems.htm>, or
|
||
|
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_tsqlcon_6lyk.asp?frame=true> (open in IE).
|
||
|
|
||
|
JavaScript - http://academ.hvcc.edu/~kantopet/javascript/index.php
|
||
|
|
||
|
Python - http://www.python.org/doc/2.3.4/ref/ref.html
|
||
|
|
||
|
PHP - http://www.php.net/manual/en/langref.php
|
||
|
|
||
|
Visual Basic - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbls7/html/vbspecstart.asp. Open in IE.
|
||
|
|
||
|
Pascal - <http://pages.cpsc.ucalgary.ca/~becker/231/SyntaxDiagrams/pascal-syntax_files/frame.htm>. Open in IE.
|
||
|
|
||
|
Ruby - http://www.rubycentral.com/book/
|
||
|
|
||
|
ActionScript 2 - <http://download.macromedia.com/pub/documentation/en/flash/fl8/fl8_as2lr.pdf>
|
||
|
ActionScript 3 - <http://download.macromedia.com/pub/documentation/en/flex/2/prog_actionscript30.pdf>
|
||
|
E2X - http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-357.pdf
|
||
|
|
||
|
R - Somewhere on http://www.r-project.org.
|
||
|
|
||
|
ColdFusion - <http://livedocs.macromedia.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/contents.htm>
|
||
|
|
||
|
Eiffel - http://www.gobosoft.com/eiffel/syntax/
|