diff --git a/autotests/folding/test.coffee.fold b/autotests/folding/test.coffee.fold index 8763ef5..de7ad09 100644 --- a/autotests/folding/test.coffee.fold +++ b/autotests/folding/test.coffee.fold @@ -1,58 +1,71 @@ # CoffeeScript test # Source: https://coffeescript.org -### Multiline - comment ### +### Multiline + comment ### import 'local-file.coffee' # Assignment: number = 42 opposite = true # Conditions: number = -42 if opposite # Functions: square = (x) -> x * x # Arrays: list = [1, 2, 3, 4, 5] # Objects: math = root: Math.sqrt square: square cube: (x) -> x * square x # Splats: race = (winner, runners...) -> print winner, runners # Existence: alert "I knew it!" if elvis? # Array comprehensions: cubes = (math.cube num for num in list) # Classes: class Animal constructor: (@name) -> move: (meters) -> alert @name + " moved #{meters}m." # Switch/When/Else: switch day when "Mon" then go work when "Tue" then go relax when "Thu" then go iceFishing when "Fri", "Sat" if day is bingoDay go bingo go dancing when "Sun" then go church else go work # Member objects: Object.prop. Object .Object Object timelineEvent.class + +# Embedded JavaScript Code +markdown = `function () { + return \`In Markdown, write code like \\\`this\\\`\`; +}` + +``` + // Comment + var array = new Array(500); + var name = "Willy"; + alert(`Hello ${name}!`); +``` +` String.raw\`String ${x} \` ` diff --git a/autotests/html/test.coffee.html b/autotests/html/test.coffee.html index af590d5..57c9251 100644 --- a/autotests/html/test.coffee.html +++ b/autotests/html/test.coffee.html @@ -1,65 +1,78 @@ test.coffee
 # CoffeeScript test
 # Source: https://coffeescript.org
 
 ### Multiline
   comment ###
 import 'local-file.coffee'
 
 # Assignment:
 number   = 42
 opposite = true
 
 # Conditions:
 number = -42 if opposite
 
 # Functions:
 square = (x) -> x * x
 
 # Arrays:
 list = [1, 2, 3, 4, 5]
 
 # Objects:
 math =
   root:   Math.sqrt
   square: square
   cube:   (x) -> x * square x
 
 # Splats:
 race = (winner, runners...) ->
   print winner, runners
 
 # Existence:
 alert "I knew it!" if elvis?
 
 # Array comprehensions:
 cubes = (math.cube num for num in list)
 
 # Classes:
 class Animal
   constructor: (@name) ->
 
   move: (meters) ->
     alert @name + " moved #{meters}m."
 
 # Switch/When/Else:
 switch day
   when "Mon" then go work
   when "Tue" then go relax
   when "Thu" then go iceFishing
   when "Fri", "Sat"
     if day is bingoDay
       go bingo
       go dancing
   when "Sun" then go church
   else go work
 
 # Member objects:
 Object.prop.  Object .Object Object
 timelineEvent.class
+
+# Embedded JavaScript Code
+markdown = `function () {
+  return \`In Markdown, write code like \\\`this\\\`\`;
+}`
+
+```
+	// Comment
+	var array = new Array(500);
+	var name = "Willy";
+	alert(`Hello ${name}!`);
+```
+` String.raw\`String ${x} \` `
 
diff --git a/autotests/input/test.coffee b/autotests/input/test.coffee index ecdf5fd..56f8a69 100644 --- a/autotests/input/test.coffee +++ b/autotests/input/test.coffee @@ -1,58 +1,71 @@ # CoffeeScript test # Source: https://coffeescript.org ### Multiline comment ### import 'local-file.coffee' # Assignment: number = 42 opposite = true # Conditions: number = -42 if opposite # Functions: square = (x) -> x * x # Arrays: list = [1, 2, 3, 4, 5] # Objects: math = root: Math.sqrt square: square cube: (x) -> x * square x # Splats: race = (winner, runners...) -> print winner, runners # Existence: alert "I knew it!" if elvis? # Array comprehensions: cubes = (math.cube num for num in list) # Classes: class Animal constructor: (@name) -> move: (meters) -> alert @name + " moved #{meters}m." # Switch/When/Else: switch day when "Mon" then go work when "Tue" then go relax when "Thu" then go iceFishing when "Fri", "Sat" if day is bingoDay go bingo go dancing when "Sun" then go church else go work # Member objects: Object.prop. Object .Object Object timelineEvent.class + +# Embedded JavaScript Code +markdown = `function () { + return \`In Markdown, write code like \\\`this\\\`\`; +}` + +``` + // Comment + var array = new Array(500); + var name = "Willy"; + alert(`Hello ${name}!`); +``` +` String.raw\`String ${x} \` ` diff --git a/autotests/reference/test.coffee.ref b/autotests/reference/test.coffee.ref index 08499b2..db56170 100644 --- a/autotests/reference/test.coffee.ref +++ b/autotests/reference/test.coffee.ref @@ -1,58 +1,71 @@ # CoffeeScript test
# Source: https://coffeescript.org

### Multiline
comment ###
import 'local-file.coffee'

# Assignment:
number = 42
opposite = true

# Conditions:
number = -42 if opposite

# Functions:
square = (x) -> x * x

# Arrays:
list = [1, 2, 3, 4, 5]

# Objects:
math =
root: Math.sqrt
square: square
cube: (x) -> x * square x

# Splats:
race = (winner, runners...) ->
print winner, runners

# Existence:
alert "I knew it!" if elvis?

# Array comprehensions:
cubes = (math.cube num for num in list)

# Classes:
class Animal
constructor: (@name) ->

move: (meters) ->
alert @name + " moved #{meters}m."

# Switch/When/Else:
switch day
when "Mon" then go work
when "Tue" then go relax
when "Thu" then go iceFishing
when "Fri", "Sat"
if day is bingoDay
go bingo
go dancing
when "Sun" then go church
else go work

# Member objects:
Object.prop. Object .Object Object
timelineEvent.class
+
+# Embedded JavaScript Code
+markdown = `function () {
+ return \`In Markdown, write code like \\\`this\\\`\`;
+}`
+
+```
+ // Comment
+ var array = new Array(500);
+ var name = "Willy";
+ alert(${name});
+```
+` String.raw\`String ${x} \` `
diff --git a/data/syntax/coffee.xml b/data/syntax/coffee.xml index 1f60f4a..2b54b88 100644 --- a/data/syntax/coffee.xml +++ b/data/syntax/coffee.xml @@ -1,274 +1,341 @@ false true yes no on off undefined null NaN Infinity return break continue throw for while until loop if else unless switch when then and or in do of by is isnt not typeof delete where super try catch finally try catch finally constructor class extends new instanceof case default function var void with const let enum export import native __hasProp __extends __slice __bind __indexOf Object Number Boolean Array String RegExp Function Date Math eval setInterval clearInterval setTimeout clearTimeout isFinite isNaN parseFloat parseInt escape unescape console encodeURI encodeURIComponent decodeURI decodeURIComponent window document navigator location history screen alert prompt process GLOBAL require exports + - + - + - + - + + + + + + + + + + + - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - +