Using special character ^ or ¨ in python 3 idle crashes the program - crash

When I use these specials characters ^ or ¨ in python IDLE version 3, it makes the program crash.
I'm French and so I use these specials characters in my description or comments in my code.
Is there a way to use it without crashing the program?
Thanks !

Many language specifications, and most compilers, specifically recommend against using special characters because of problems like this.
However, from http://docs.python.org/2/reference/lexical_analysis.html
New in version 2.3: An encoding declaration can be used to indicate
that string literals and comments use an encoding different from
ASCII.
So include that declaration, and it should work.
If you already have such a declaration, the problem may then be not because of the characters themselves, but because of the way your setup combines the ^ and ¨ accents with other characters. Although at that point, I'm really just shooting in the dark.

Related

How can I make a VS Code language extension insert an indent after a line ending in a colon, as in Python?

The VS Code documentation has a clear if short explanation of how to do custom indentation, but doing this has no effect — whatever I put in the "indentationRules", it fails to match the simplest patterns, and it doesn't even stop the built-in indentation from working, it goes right on using the default indentation described in the link above. All the other bits of the language extension are working, it's not a general problem, it's specific to trying to get these indentation rules to work. I've tried to find examples to copy from the internet but with no success. (I found an example of a grammar for Python but the only mention of indentation in it was as a possible kind of error, which is puzzling.)
Thanks for your help.

Gradle build failing with many "unmappable character for encoding UTF-8" errors

I'm seeing many "unmappable character for encoding UTF-8" errors messages when I run a gradle build like this:
C:\5.0-Maint-New-Techs\src\com\avada\jms\base\JmsUtils.java:136: error: unmappable character for encoding UTF-8
� You can use arrays as well as primitive types for the values.
When I go to the lines that are flagged this way, they look perfectly fine in my editor. Not sure if this is a gradle or idea issue...any ideas on how to get around these errors?
Please change the non-ascii characters to double quotes(") or any other character(this is basically work around solution of the problem). This problem will be resolved. I think this issue is due to intellij.

Say I didn't like the syntax of objC blocks... (or: how to customize llvm a little bit)

...is there anything I could do about it?
To be more precise, I would like to replace the caret "^" with something like "§" - granted, there's not much left on the keyboard that's not in use already.
After thinking about it for a while (dismissed using run script build phases along the way) I think the only way to do it would be a custom llvm build.
While I don't quite think I'm ready to deal with the internals of compilers, I have the naive hope that replacing one symbol with another isn't too hard. And the idea of building and running my own version of a compiler tickles me, be it just for a good deal of childish fun.
So I started poking around in the llvm sources, but - surprise - got nowhere so far.
If someone is familiar with these kind of things, could you please point me to a place to look at?
That would be awesome! Thanks!
Extending LLVM can be a bit of a hassle, especially considering how fast-moving the compiler team is, so it's a good thing you don't have to. The C preprocessor exists to perform the exact same thing you've outlined (text replacement). I'm fairly sure § isn't aliased to anything important, so #define § ^ should work great. If you still want to write your own module, LLVM provides instructions on how to extend their compiler.
Actually the code relevant for such a change isn't a part of LLVM at all, but a part of its Objective-C frontend, called Clang. Confusingly, "Clang" is also the name of the entire C/C++/ObjC compiler based on both Clang and LLVM.
While I don't quite think I'm ready to deal with the internals of compilers, I have the naive hope that replacing one symbol with another isn't too hard.
And you'll be right. What you're trying to do is very simple change.
In fact, if ^ was only used for blocks, it would be a trivial change - just modify the lexer to generate the "caret" token from § instead of ^: take a look at the lexer code to see what I mean (search for ^).
Unfortunately it's used for xor as well, so we'll have to modify both the lexer and the parser. The lexer to add a new token type and create that token from §, the parser to actually do something with it, e.g. by adding:
case tok::section: // 'section' is the token type you've added
Res = ParseBlockLiteralExpression();
break;
(and then fixing the assert at the beginning of ParseBlockLiteralExpression()).
You might run into some issues, though, as § isn't in ASCII - though as far as I know Clang should be able to deal with UTF-8 encoded files.

VB.NET Linebreak Changes

Does anyone know if I can find a list of where the line break (_) is no longer required. So far I notice parameter lists and attributes now work without the line break char.
Technically speaking, it's called a line continuation character.
This is not a feature of the .NET Framework version, it's a feature of the compiler. The first version to support it is VB.NET 10, the one included with Visual Studio 2010.
The new feature is documented here, including a nice table listing where continuation is implicit.
Visual Basic is a line-oriented language that uses clear, English-like syntax to enhance readability. But that often results in code that runs up against the 80-character-per-line limit, forcing developers to scroll a lot. You can use the underscore character to tell the compiler that it should keep processing the next line as part of the current one (that is, treat multiple physical lines as a single, logical line). But having to type underscores repeatedly has always been annoying, and in fact, for years the No. 1 feature request has been for the compiler to “just figure it out.”
Well, in Visual Basic 2010, the compiler can. It now knows which tokens (such as commas, parentheses and operators) tend to occur right before the line-continuation character, and it inserts the character so developers no longer need to. For example, ending a Visual Basic statement with a comma is never legal; the compiler knows this, so when it sees a token stream that looks like {comma, enter}, it infers the presence of the line continuation character
[ . . . ]
As you can see, there are more than 60 places where the language doesn’t require underscores. (In fact, none of the code samples in this article required the line-continuation character.) Of course, you can still use the underscore, so code from previous versions of Visual Basic will still compile as expected.
The rules for where you can break a line haven't changed. You just no longer need the _ at all with the later compilers.

Who does non-decimal bignums with floating radix point?

Nice as the Tcl libraries math::bignum and math::bigfloat are, the middle ground between the two needs to be addressed. Namely, bignums which are in different radices and have a radix point.
At present math::bignum only handles integers (afaict) and math::bigfloat won't let you specify different radices to math::bigfloat::fromstr (ditto).
Does anyone know of a library, for any of the major scripting languages (e.g. Tcl, Perl, Python, Ruby, Lua) or less major ones (newLISP for example), which implements bignums in different radices with handling for radix point?
bignumber.js is a Javascript library that handles numbers with a radix point in bases from 2 to 36.
I couldn't find any libraries for this, but I haven't looked for long.
But you can work around the problem similar to what you would do if you want 64-bit datatypes, but only 32-bit datatypes are available. With the libraries you already have, you should be able to represent a number in base b like this:
ABCDEF.GHIJKLMN
can be split to the two bignums ABCDEF and GHIJKLMN. GHIJKLMN in fact is representing GHIJLMN / pow(b, length(GHIJKLMN)) => GHIJKLM / pow(b, 8). Now you can overwrite the operators you need which should be possible for things like +, -, *, /. If you need more things like sqrt, log or pow, this workaround will get too complex and you should really look for a library.
Your best bet is to use GMP (libgmp).
I myself have looked long and hard for a .NET version without luck.