Error 2 'If', 'ElseIf', 'Else', 'End If', 'Const', or 'Region' expected - vb.net

I've made some function that generates an email template. Code it generates is pure HTML with CSS. Problem is compiler does this odd error and highlights each time '#' sign appears which is needed to define colors in CSS. I did try to change '#' to '/pound/' and then string.Replace() on RETURN but no luck. I'm more into C# so there i can escape special characters by using '\' before them but something f$#$ed up there... Once i remove '#' all back to normal and compiles well.
Any guesses ?
btw, i'm using StringBuilder to generate lines of code with sb.Append().
ie.
sb.Append("<div style=""color:#333"">some text</div>")

I think it's a bug,
to reproduce it I used VB.NET 2 (VS 2005), I wrote your instruction:
sb.Append("<div style=""color:#333"">some text</div>")
no problem,
I added some extra " to have the error message you got,
I then fixed everything, all errors disappeared except yours.
Solution: Delete that line, error disappeared, ctrl-z (undo) --> all ok!

I was receiving this same exact error and was able to simply copy the line, delete the line out, re-add a new line, and paste.

Related

Intellij is incorrectly formatting my `.yml` file, I cannot see any errors in my style settings. how can I fix it?

Intellij keeps formatting my spotbugs.yml file incorrectly, and so breaking the github action.
I cannot figure out why it's doing this:
It was working fine last week, I haven't made any changes to the formatting config, but now, every time I change focus from the file Intellij auto-formats like this, then saves it. How can I fix it?
The thing I don't get is what it's formatting to appears to be invalid yaml, right?
YAML has a syntax that makes it incompatible with indentation that is not 2 spaces. With 4 spaces, you have:
droggel:
jug:
- sequence item: with indentation
this line: isn't aligned to four spaces
nor are further indented lines:
if you indent relative four spaces
spam:
- same: problem
without: indenting the sequence item
This makes it hard for code formatters to get it right. Proper alignment would mean:
droggel:
jug:
- three spaces after the sequence item indicator.
that's horrible, nobody does that.
spam:
- alternatively this.
nobody does this either and it breaks
- - with nested sequences
I assume some bug in IntelliJ causes the formatter to be confused because of this. Generally it would be better to just use 2 space indentation which seems far more natural due to the problems described above. That should avoid confusing the formatter.

OpenSCAD parser error in the *middle* of a comment when last line accidentally uncommented?

I have the following segment of comment in my code file (the last line is intentionally missing the slash characters - that the error):
// * Cube Back Text from Méi guī
// 一颗 心 怕 摔倒 打破
//"yī kē xīn pà shuāi dǎo dǎ pò"
// "It's the heart afraid of breaking"
// 不敢 起舞 欢 歌
// "bù gǎn qǐwǔ huāngē"
// "that never learns to dance."
不敢起舞欢歌 (dance)
But the red error dot appears on the second character of the second line (second slash of the line "// * Cube Back Text from Méi guī".
Stranger, if I remove various quotes in the comment, the character that is hilited changes.
I assume this has something to do with a recursive structure somewhere in the parser that is continuing to parse the quotes inside the comment itself and ultimately figures out where to signal the error.
I suppose this is a bug ("semi-bug") that I should post to the GitHub list - to completely ignore anything past the second slash on a commented line, or some other change so that the error tag shows up on the line where the error actually is?
As it is, I futzed around about 10 minutes wondering if OpenSCAD just didn't like files longer than 575 lines.
I get the same problem when I try your example or modify it slightly but it worked perfectly when I replaced everything with random Latin characters so I think the bug has a lot to do with the Chinese ideographs you used.
In any case, I only copied the small sample you gave so it probably have nothing to do with the length of the file.

invalid syntax in generating a variable in Stata

While creating this variable in stata14 I've got an error (198)
this is the variable that I want to generate:
g ncskew =(-(([_n])*([_n-1])^(1.5)*(sum(returns^3))))///
/(([_n-1])*([_n-2])*(sum(returns^2)^(1.5))
It is quite a puzzle but I think that the brackets are well placed.
Any help or advice would be appreciated.
The problem that jumps out at my eye is that the /// at the end of the first line is not preceded by any whitespace. That is a syntax error.
The other problem is that you have 13 opening parentheses ( and just 12 closing parentheses ). Is this your actual code or a mis-typed copy?
Whether that are the only problems with your code, I cannot say. If that is your actual code, fix that first and see what happens.

How do I change the way syntax warnings for a missing semi-colon (red squiggly lines) are generated?

I love the fact that IntelliJ evaluates my code for syntax errors, but I don't like that it shows common errors on the current line as I'm typing.
There are several examples of this, but the most common one is the red error line (squiggly underline) for a missing semi-colon. I don't want the editor to check for this error until after I've finished typing the line and have pressed return. In fact, I really don't want the editor to evaluate the current line for ANY syntax errors until after I've completed it. The constant changing of the error indicators on the current line as I type is getting annoying.
I've looked around in the various options, but I can't seem to even find the name of squiggle line feature. It isn't code analysis, as that applies to the red and yellow indicators in the right margin. What is the name of this feature, and where can I find the options for it?
Example ( '|' is the current carrot position, '~~' are the red error lines)
System.Out = |
~~
The issue isn't limited to just the semi-colon, but for all sorts of other common syntax issues that I know I know about and will fix before moving on to the next line.
Update: I think the name of the feature is "error highlighting". But I still can't find any way to disable it for the current line. The closest I found was Setting --> Editor --> General --> Error Highlighting --> Reparse Delay, but that changed it globally with no option for just the current line.
There is no option in IntelliJ IDEA to disable error highlighting for the current line.
You can change the Settings -> Editor -> General -> Error Highlighting -> Auto reparse delay (ms) to something more comfortable, e.g. 3000 ms.
It will still highlight the error, but not immediately.

Why can't I comment out this string?

I'm unable to comment-out and compile the following line of code with /* */, within the XCode editor. I distilled this example down from a more complex string used in an XPath query:
the string itself seems fine:
NSString* s = #"//*//";
won't compile for me:
/*
NSString* s = #"//*//";
*/
XCode 4.4. I'll file a radar if anyone can confirm I'm not being stupid.
EDIT: nice to see that the SO syntax highlighter also exhibits an issue with this...
EDIT: okay, I filed a bug report with Apple. Thanks.
EDIT: Per Rob's answer below, this is NOT a bug :) Thanks for explaining it, Rob; totally makes sense now.
This is not a compiler bug. The double-quote character " has no special meaning inside a comment, so the preprocessor doesn't pay any attention to it. The preprocessor just ends the comment as soon as it sees the */ characters.
The best way to comment out a section of code is to put // at the beginning of each line. A // comment ends at the next newline. Xcode has a menu command (shortcut: ⌘/) that will comment or uncomment your selected lines by inserting or removing // at the start of each line.
It detects and end comment in #"//*//"; I don't know of any editor that allows nesting of block comments (I know that's not what you're doing, but same issue). Notice how even the syntax highlighter on SO screws up.