Problem with the custom Nemerle statement

What I would like to write in my code is the following.

c² = a² + b²

At first I tried to create a macro for ². I have tried the following.

  macro @² (x)
syntax (x,"²")
{
 <[ 
($x * $x)

  ]>
}

But I expect an identifier error in (x)So, I tried

  macro @s (x)
syntax (x,"²")
{
 <[ 
($x * $x)

  ]>
}

Now I get an unsupported syntax token error on "²".

So, I ask 1. Can I write an operator ²? 2. What are the supported syntax tokens?

+3
source share
1 answer

ASCII 255 : '=', '<', ' > ', '@', '^', '&', '-', '+', '|', '*', '/', '$', '%', '!', '?', '~', '.', ':', '# ','\',' '', '(', ')', ';', '[', ']'.

"²" , , , .

+5

Source: https://habr.com/ru/post/1789096/


All Articles