Skip to content

Commit

Permalink
fixed several markup errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgenvinju committed Jul 6, 2023
1 parent 1d1302d commit f035e66
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 58 deletions.
20 changes: 8 additions & 12 deletions courses/Rascal/Declarations/Function/Function.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ There are some restrictions however:

* Overloaded alternatives for the same function name but with different patterns must return the same type.
* Overloaded alternatives for the same function name must have mutually exclusive patterns, unless one alternative is labeled `default` and the other is not. The patterns of formal parameters are mutually exclusive if for at least one parameter position:
** They range over incomparable types, as in `int f(int a)` and `int f(real a)`, or
** They range over different alternatives of an ((Algebraic Data Type)), as in `int f(and(Bool a, Bool b))` and `int f(or(Bool a, Bool b))`
** They range over different alternatives of a ((Syntax Definition))
** And note that deep matches using the `/` alternative are considered to be of type `value` and therefore overlap with all other patterns.
* They range over incomparable types, as in `int f(int a)` and `int f(real a)`, or
* They range over different alternatives of an ((Algebraic Data Type)), as in `int f(and(Bool a, Bool b))` and `int f(or(Bool a, Bool b))`
* They range over different alternatives of a ((Syntax Definition))
* And note that deep matches using the `/` alternative are considered to be of type `value` and therefore overlap with all other patterns.
* Overlapping patterns are allowed if the one alternative has the `default` modified while the other does not.
* If a function is fallible, it uses the `fail` statement to back-track to a different alternative, then there must be a `default` alternative defined which can handle the general case. An ((AlgebraicDataType)) or a ((SyntaxDefinition)) with the same name and return type counts as a `default` alternative.
* `default` functions may not fail.
Expand All @@ -124,14 +124,10 @@ The _Modifiers_ affect _visibility_ and _special behaviour_ of functions:
* _Visibility_: `private` declares that a function is only visible in the current module.
`public` declares that it is visible outside the module as well. When visibility is not specified, `private` is assumed.
* _Special Behaviour_:
** `java` declares that the body of the function is implemented in Java. The function should have a
`javaClass` annotation that determines where the Java implementation can be found.
** `test` declares that this is a test function. A test function is a boolean function (currently) without arguments.
It can be called as any other function. However, it can also be called automatically
by the unit test framework, by typing `:test` at the command line, see [Help](/docs/GettingHelp/CommandLine/).
** `default` declares an alternative for an overloaded function that will only be tried after
all non-default alternatives have been tried. Note that ((Algebraic Data Type))s and ((Syntax Definition))s
_implicitly_ define `default` functions that may be overloaded by normal ((Function Declarations))s.
* `java` declares that the body of the function is implemented in Java. The function should have a `javaClass` annotation that determines where the Java implementation can be found.
* `test` declares that this is a test function. A test function is a boolean function (currently) without arguments. It can be called as any other function. However, it can also be called automatically by the unit test framework, by typing `:test` at the command line, see [Help](/docs/GettingHelp/CommandLine/).
* `default` declares an alternative for an overloaded function that will only be tried after
all non-default alternatives have been tried. Note that ((Algebraic Data Type))s and ((Syntax Definition))s _implicitly_ define `default` functions that may be overloaded by normal ((Function Declarations))s.


#### Examples
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ When you are completely desparate and cannot find the syntax error, the followin

* Surround all text in the module (except the module header) with `/*` and `*/`. Now your module should parse. If not the syntax error is in the module header.
* Move the upper comment symbol `/*` to the middle of the file. Now there are two possibilities:
** The module parses. The top part is correct and the syntax error is in the bottom part.
Move the `/*` marker to the middle of the bottom part and repeat.
** The module does not parse. The syntax error is in the top part.
Move the `/*` marker to the middle of the top part and repeat.
* The module parses. The top part is correct and the syntax error is in the bottom part. Move the `/*` marker to the middle of the bottom part and repeat.
* The module does not parse. The syntax error is in the top part. Move the `/*` marker to the middle of the top part and repeat.

#### Examples

Expand Down
5 changes: 3 additions & 2 deletions courses/Rascal/Statements/Assignment/Slice/Slice.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ Let _V_ be the current value of _Assignable_.
`begin`, `begin+step`. ... `end-step` <= `index < end` replaced by the successive elements of the value of _Exp_~4~.
Note that the size of _V_ and _V_' may differ. _V_' is assigned to the _Assignable_.
If the number of indices in the slice and the number of elements in the value of _Exp_~4~ is not equal the following is done:
** If the number of elements in the slice is larger: the elements of _Exp~4~_ are used in a circular manner.
** If the number of elements in the slice is smaller: the remaining elements of _Exp~4~_ is inserted after the last index in the slice.
* If the number of elements in the slice is larger: the elements of _Exp~4~_ are used in a circular manner.
* If the number of elements in the slice is smaller: the remaining elements of _Exp~4~_ is inserted after the last index in the slice.


#### Examples

Expand Down
6 changes: 3 additions & 3 deletions courses/Rascal/Statements/Fail/Fail.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ When `fail` is executed:

* If the associated pattern has more alternatives, the next alternative is explored,
* otherwise the pattern as a whole fails.
** In the case of switch or visit this means that the next case will be tried.
** For while, do and for, this implies that any bindings caused by the pattern are undone and that the next
* In the case of switch or visit this means that the next case will be tried.
* For while, do and for, this implies that any bindings caused by the pattern are undone and that the next
alternative in the test is tried; otherwise the loop is terminated.
** For a function call it means that the next function declaration (or the default one) is tried.
* For a function call it means that the next function declaration (or the default one) is tried.

#### Examples

Expand Down

0 comments on commit f035e66

Please sign in to comment.