Unicode

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Unicode

jim kuo
I've been trying to learn amber since it was called Jtalk and have a
question. As you know JavaScript fully supports Unicode  programming,
that is, one can use Unicode for object and function names. I've tried
to do some Chinese programming in Amber but there seems is some
checking method that will prevent Unicode character being used as
selector, class or variable names. I think this is a limit that is not
necessary. Pharo/Squeak may have some limitations in Unicode support
but Amber can use JavaScript String functions to replace Smalltalk
ones so there should not be to many troubles.
So please consider support Unicode programming at the very early stage
of language since it might be more difficult after the system has
grown big.
Reply | Threaded
Open this post in threaded view
|

Re: Unicode

gokr
Sounds fair to look into, do you know more specifically where to dig?



-- Sent from my Palm Pre 2, wohoo!


On Dec 16, 2011 9:23, JG <[hidden email]> wrote:

I've been trying to learn amber since it was called Jtalk and have a
question. As you know JavaScript fully supports Unicode programming,
that is, one can use Unicode for object and function names. I've tried
to do some Chinese programming in Amber but there seems is some
checking method that will prevent Unicode character being used as
selector, class or variable names. I think this is a limit that is not
necessary. Pharo/Squeak may have some limitations in Unicode support
but Amber can use JavaScript String functions to replace Smalltalk
ones so there should not be to many troubles.
So please consider support Unicode programming at the very early stage
of language since it might be more difficult after the system has
grown big.
Reply | Threaded
Open this post in threaded view
|

Re: Unicode

jim kuo
Unfortunately, my install of amber, which used to work, doesn't
display a browser anymore. I will try to locate the code once I get it
run again.

On Dec 16, 4:26 pm, "Göran Krampe" <[hidden email]> wrote:

> Sounds fair to look into, do you know more specifically where to dig?-- Sent from my Palm Pre 2, wohoo!On Dec 16, 2011 9:23, JG <[hidden email]> wrote:I've been trying to learn amber since it was called Jtalk and have a
> question. As you know JavaScript fully supports Unicode programming,
> that is, one can use Unicode for object and function names. I've tried
> to do some Chinese programming in Amber but there seems is some
> checking method that will prevent Unicode character being used as
> selector, class or variable names. I think this is a limit that is not
> necessary. Pharo/Squeak may have some limitations in Unicode support
> but Amber can use JavaScript String functions to replace Smalltalk
> ones so there should not be to many troubles.
> So please consider support Unicode programming at the very early stage
> of language since it might be more difficult after the system has
> grown big.
Reply | Threaded
Open this post in threaded view
|

Re: Unicode

jim kuo
In reply to this post by gokr
Göran Krampe-3 wrote
Sounds fair to look into, do you know more specifically where to dig? -- Sent from my Palm Pre 2, wohoo!
Sorry for a very late response but I checked and found these lines of code in repl/amber.js

 
var expected = buildExpected(rightmostMatchFailuresExpected);
        var actualPos = Math.max(pos, rightmostMatchFailuresPos);
        var actual = actualPos < input.length
          ? quote(input.charAt(actualPos))
          : 'end of input';
        
        return 'Expected ' + expected + ' but ' + actual + ' found.';

parsing error when using unicode selectors
Reply | Threaded
Open this post in threaded view
|

Re: Unicode

jim kuo
Some information about this. Actually what I am doing is to export excel tables for financial data of a hospital into json and to analyze those data using Amber.  The json-file contents are like this(you need not to know chinese):
 list:= < {
  "rows" : [
    {
      "科室名称" : " 全院",
      "治愈率(%)" : 58.25,
      "好转率(%)" : 36.617000579833984,
      "病死率(%)" : 0.6050000190734863
    },
    {
      "科室名称" : "  内科",
      "治愈率(%)" : 15.333000183105469,
      "好转率(%)" : 77.73200225830078,
      "病死率(%)" : 1.1920000314712524
    }
  ]
}>
If I could use Unicode character in selectors then it would be very easy to do something like:
 list rows first 科室名称 
but now I will get a parsing error at "科室名称" and I have to do it this way:
 list rows first at:'科室名称'
and this use case of Unicode is just one of the simplest examples.

Reply | Threaded
Open this post in threaded view
|

Re: Unicode

Manfred Kröhnert
In reply to this post by jim kuo

Hi,
this is a limitation of the current parser grammar which is used by Amber, the compiler and the Repl.
It only accepts a-z and A-Z as characters.

To expand the parser to handle Unicode we have to include and exclude special ranges of the Unicode alphabet in the right places of the grammar.

Maybe you could open an issue on GitHub so we don't forget about this.

Best,
Manfred

Am 11.01.2013 18:58 schrieb "jim kuo" <[hidden email]>:
Göran Krampe-3 wrote
> Sounds fair to look into, do you know more specifically where to dig? --
> Sent from my Palm Pre 2, wohoo!

Sorry for a very late response but I checked and found these lines of code
in repl/amber.js



<http://forum.world.st/file/n4662592/amberParsingError.gif>



--
View this message in context: http://forum.world.st/Unicode-tp4203739p4662592.html
Sent from the Amber Smalltalk mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Unicode

jim kuo
Thanks. I've just added one issue.