Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34197 > unrolled thread
| Started by | Popping mad <rainbow@colition.gov> |
|---|---|
| First post | 2016-04-26 06:32 +0000 |
| Last post | 2016-05-30 21:50 -0700 |
| Articles | 11 — 6 participants |
Back to article view | Back to comp.lang.java.programmer
error: unclosed character literal Popping mad <rainbow@colition.gov> - 2016-04-26 06:32 +0000
Re: error: unclosed character literal Andreas Leitgeb <avl@logic.at> - 2016-04-26 06:57 +0000
Re: error: unclosed character literal Lew <lewbloch@gmail.com> - 2016-04-26 13:51 -0700
Re: error: unclosed character literal Andreas Leitgeb <avl@logic.at> - 2016-04-26 22:01 +0000
Re: error: unclosed character literal Andreas Leitgeb <avl@logic.at> - 2016-04-26 22:04 +0000
Re: error: unclosed character literal Arne Vajhøj <arne@vajhoej.dk> - 2016-04-26 19:34 -0400
Re: error: unclosed character literal Roedy Green <see_website@mindprod.com.invalid> - 2016-05-25 08:29 -0700
Re: error: unclosed character literal Lew <lewbloch@gmail.com> - 2016-05-25 14:30 -0700
Re: error: unclosed character literal Arne Vajhøj <arne@vajhoej.dk> - 2016-04-26 19:38 -0400
Re: error: unclosed character literal Lew <lewbloch@gmail.com> - 2016-04-28 12:56 -0700
Re: error: unclosed character literal Roedy Green <inquiry@mindprod.com> - 2016-05-30 21:50 -0700
| From | Popping mad <rainbow@colition.gov> |
|---|---|
| Date | 2016-04-26 06:32 +0000 |
| Subject | error: unclosed character literal |
| Message-ID | <nfn223$2q2$2@reader1.panix.com> |
TypeCheckingVisitor.java:61: error: unclosed character literal
if(op == '>' || op == '<' || op == '<=' || op == '>=' ){
The editor also indicates a parsing problem in the Java but I am at a loss.
'<' seems to work
This is the code snippet
//Comparison Operators
¦if(op == '>' || op == '<' || op == '<=' || op == '>=' ){
¦if( (leftType == Type.INT && rightType == Type.INT) || (leftType== Type.FLOAT || rightType== Type.FLOAT)|| (leftType == Type.INT && rightType == Type.FLOAT)|| (leftType == Type.FLOAT && rightType == Type.INT ) ){
¦return trace(ctx, Type.BOOL);
¦}
¦ ¦ ¦return typeMismatch(ctx, leftType, rightType);
¦}
[toc] | [next] | [standalone]
| From | Andreas Leitgeb <avl@logic.at> |
|---|---|
| Date | 2016-04-26 06:57 +0000 |
| Message-ID | <slrnnhu4gt.456.avl@login.logic.tuwien.ac.at> |
| In reply to | #34197 |
Popping mad <rainbow@colition.gov> wrote:
> TypeCheckingVisitor.java:61: error: unclosed character literal
> if(op == '>' || op == '<' || op == '<=' || op == '>=' ){
> The editor also indicates a parsing problem in the Java but I am at a loss.
> '<' seems to work
Character literals consist of *single* characters.
I wonder, how you even think to get a <= into the char op
in the first place.
If you're writing some parser for your own language, you could
instead switch to unicode symbols for "greater or equal", etc,
otherwise you probably should define op as an enum Operator with
an enum constant for each supported operator.
[toc] | [prev] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2016-04-26 13:51 -0700 |
| Message-ID | <2381387d-f93b-48d2-ac09-64a1dd18a744@googlegroups.com> |
| In reply to | #34198 |
On Tuesday, April 26, 2016 at 12:00:56 AM UTC-7, Andreas Leitgeb wrote:
> Popping mad <rainbow@colition.gov> wrote:
> > TypeCheckingVisitor.java:61: error: unclosed character literal
> > if(op == '>' || op == '<' || op == '<=' || op == '>=' ){
> > The editor also indicates a parsing problem in the Java but I am at a loss.
> > '<' seems to work
>
> Character literals consist of *single* characters.
>
> I wonder, how you even think to get a <= into the char op
> in the first place.
>
> If you're writing some parser for your own language, you could
> instead switch to unicode symbols for "greater or equal", etc,
> otherwise you probably should define op as an enum Operator with
> an enum constant for each supported operator.
Also, you could use 'switch' instead of the if condition chains.
--
Lew
[toc] | [prev] | [next] | [standalone]
| From | Andreas Leitgeb <avl@logic.at> |
|---|---|
| Date | 2016-04-26 22:01 +0000 |
| Message-ID | <slrnnhvpfv.456.avl@login.logic.tuwien.ac.at> |
| In reply to | #34202 |
Lew <lewbloch@gmail.com> wrote:
> On Tuesday, April 26, 2016 at 12:00:56 AM UTC-7, Andreas Leitgeb wrote:
>> Popping mad <rainbow@colition.gov> wrote:
>> > TypeCheckingVisitor.java:61: error: unclosed character literal
>> > if(op == '>' || op == '<' || op == '<=' || op == '>=' ){
>> > The editor also indicates a parsing problem in the Java but I am at a loss.
>> > '<' seems to work
>> Character literals consist of *single* characters.
>> I wonder, how you even think to get a <= into the char op
>> in the first place.
>> If you're writing some parser for your own language, you could
>> instead switch to unicode symbols for "greater or equal", etc,
>> otherwise you probably should define op as an enum Operator with
>> an enum constant for each supported operator.
> Also, you could use 'switch' instead of the if condition chains.
Indeed.
And btw. this applies to both, single-character operators and enum.
But with enums there are even more ways..., like having the enum
itself offer methods to tell if the given operands are fine for
the given operator.
[toc] | [prev] | [next] | [standalone]
| From | Andreas Leitgeb <avl@logic.at> |
|---|---|
| Date | 2016-04-26 22:04 +0000 |
| Message-ID | <slrnnhvpl0.456.avl@login.logic.tuwien.ac.at> |
| In reply to | #34202 |
Stefan Ram <ram@zedat.fu-berlin.de> wrote: > Lew <lewbloch@gmail.com> writes: >>>Character literals consist of *single* characters. >>Also, you could use 'switch' instead of the if condition chains. > You quoted, »Character literals consist of *single* characters.« I'd change the "consist" to "are", and you use a proper code formatting style on future code samples... deal?
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2016-04-26 19:34 -0400 |
| Message-ID | <nfottb$hth$2@gioia.aioe.org> |
| In reply to | #34206 |
On 4/26/2016 6:04 PM, Andreas Leitgeb wrote: > Stefan Ram <ram@zedat.fu-berlin.de> wrote: >> Lew <lewbloch@gmail.com> writes: >>>> Character literals consist of *single* characters. >>> Also, you could use 'switch' instead of the if condition chains. >> You quoted, »Character literals consist of *single* characters.« > > I'd change the "consist" to "are", and you use a proper code > formatting style on future code samples... deal? Good one! Arne
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2016-05-25 08:29 -0700 |
| Message-ID | <k5hbkbhdmhbsaaq95i15b2aso3db3935cq@4ax.com> |
| In reply to | #34208 |
On Tue, 26 Apr 2016 19:34:05 -0400, Arne Vajhøj <arne@vajhoej.dk> wrote, quoted or indirectly quoted someone who said : >Good one! If ever you can't get work programming, you would all make great lawyers. -- Roedy Green Canadian Mind Products http://mindprod.com Incorrect documentation is often worse than no documentation. ~ Bertrand Meyer (born:1950 age 65)
[toc] | [prev] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2016-05-25 14:30 -0700 |
| Message-ID | <6e669507-0d38-4687-a1cb-c4b476a1caeb@googlegroups.com> |
| In reply to | #34386 |
Roedy Green wrote: > Arne Vajhøj wrote, quoted or indirectly quoted someone who said : > >Good one! > > If ever you can't get work programming, you would all make great > lawyers. Thanks! I'm considering getting a law degree in a few years, perhaps. The combination of software expertise and legal qualifications is very valuable in the marketplace. -- Lew
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2016-04-26 19:38 -0400 |
| Message-ID | <nfou69$ic0$1@gioia.aioe.org> |
| In reply to | #34202 |
On 4/26/2016 5:10 PM, Stefan Ram wrote: > Maybe the person that you have quoted wanted to say > »Character literals consist of a *single* character.«. > > But this would not be true, since > > 'a' > > is a character literal and consists of 3 characters. I would be willing to consider "consist of" to be a more plain version of "expressed as" and therefore valid. Arne
[toc] | [prev] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2016-04-28 12:56 -0700 |
| Message-ID | <260a9202-29dc-4c28-9906-0b4421752a87@googlegroups.com> |
| In reply to | #34209 |
On Tuesday, April 26, 2016 at 4:39:00 PM UTC-7, Arne Vajhøj wrote: > On 4/26/2016 5:10 PM, Stefan Ram wrote: > > Maybe the person that you have quoted wanted to say > > »Character literals consist of a *single* character.«. > > > > But this would not be true, since > > > > 'a' > > > > is a character literal and consists of 3 characters. > > I would be willing to consider "consist of" to be a more > plain version of "expressed as" and therefore valid. The char literal 'a' consists of the numeric equivalent of the character 'a', which is one character, which itself does not include apostrophes. The literal is the 16-bit item in memory, not the source code representation thereof. Just like the numeral "1" is not the number 1, but a representation thereof, the source-code representation is not the character itself. So no, the character 'a' does not consist of the three characters '\'', 'a', and '\''.
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <inquiry@mindprod.com> |
|---|---|
| Date | 2016-05-30 21:50 -0700 |
| Message-ID | <uu5qkbdnipummth7vao5fva0lc0bnh9rq2@4ax.com> |
| In reply to | #34197 |
On Tue, 26 Apr 2016 06:32:35 +0000 (UTC), Popping mad <rainbow@colition.gov> wrote: > error: unclosed character literal see http://mindprod.com/jgloss/compileerrormessages.html#UNCLOSEDCHARLIT
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web