« first day (320 days earlier)      last day (2860 days later) » 
00:00 - 18:0018:00 - 00:00

00:05
@Hosch250 The prebuild is unregistering the previous build - just remove it, build, and then reinstate it ;)
Reinstate it?
Maybe you can explain exactly what I need to do.
I have Rubberduck installed.
I removed the pre-build.
I built the project.
I ran the project.
Rubberduck fails to load.
@Mat'sMug?
00:33
Ok I uninstalled RD, then scrubbed my registry right? Then I launched Excel & VBE to confirm it was gone and VBE wasn't crashing, check. So I used configuration manager and set config to Debug64, and put that regasm in postbuild, and F5 debug worked; then to avoid refilling my registry with stale keys I added the prebuild regasm to unregister the previous debug build - and there! :)
(Sorry, was driving)
OK.
NP.
Anyway, I can uninstall it and it is gone.
But, if I uninstall it, the VBE can't see it.
Oh you need to re-add the addins64 key manually - uninstalling will remove that key
Then you should be good to go ;)
Thanks.
00:39
> If you're designing a new language, you will vastly simplify your grammar by taking care to avoid ambiguities in your language. For the love of all that is holy, don't use = to represent both comparison and assignment.
And lol
=;)-
> If you have a language application that doesn't need to visit every node in a parse tree, or if the visits are dependent on context, you should implement your logic within a visitor.
I think you should read this Mug.
Rubberduck could not be loaded.
Rubberduck is not installed.
> Although the same effect can be achieved with a visitor, using a listener does not require you to manually visit child parse tree nodes, unlike use of a visitor. By default, all nodes in a parse tree are visited by a listener; in other words, the entire parse tree is walked.
Listener to parse all the things, a visitor to do a surgical strike.
Hmm... Everything g build okay @Hosch250? Sounds like a missing key somewhere.
00:47
Yeah, it built.
It is those dumb old keys that aren't going in their proper place.
Oh. Wait. Did you run regasm with the tlb switch to get the initial tlb file?
No.
I did now.
Still not working.
I have a Rubberduck.tlb file in bin\Debug64\
I think I'm finally grokking ANTLR.
Weird man. I really don't know. To be honest, I've been having trouble running that branch too.
> However, there may be tokens you don't want to throw out, yet emitting them on the default parser channel would be unnecessary or make little sense. In that case, you can have ANTLR emit these tokens on a different lexer channel.
...

@lexer::members {
public static final int REFERENCES = 1;
public static final int WHITESPACE = 2;
}

...

WS : [ \t\r\n]+ -> channel(WHITESPACE);
ENT_REF_IDX : '#ENTREF{' IntegerLiteral '}' -> channel(REFERENCES);
And that fixes the comment problem. Mug, we can parse the comments themselves for @ tokens.
The main lexer doesn't care about the comments, but the features that do could use them.
Calculator first.
Then, I'm going to translate the official spec.
Then we can mod it to do what we need.
Working on my calculator from a different direction.
SC first.
01:00
I found a unique feature.
If I read my input with Console.ReadKey() one character at a time, it will clear the console when I'm done.
Really? Nifty!
Sure will :)
I'm going to read it one token at a time like I did in C++
Hmm... Or the whole thing. We could define something like....
I will probably post mine late, I have a couple assignments that really need my attention.
MARKER : ([WS] COMMENT-START [WS] '@' LITERAL+)
Not quite. Needs to be part of the procedure if it's available
01:30
After we fix the grammar, I'll try a PR on the repo I grabbed it from ;)
So the inspection code and even bits of the grammar are starting to make sense. Unfortunately, I'm stuck at figuring out how to build the project and get it into Office 2013 x86 from scratch. Build Solution (F6) completed successfully and I ran the Rubberduck.reg in the Debug folder, but I'm not sure what the next step is. It is not showing up in the Excel add-in list.
hi! is there a HKEY_CURRENT_USER\Software\Microsoft\VBA\VBE\6.0\Addins\Rubberduck.Extension key in your registry?
(glad to see my code makes sense to someone else than me!)
There's not, I only have MZTools in that reg folder.
that's where Office apps look for add-ins
create a new Rubberduck.Extension key there
then add a DWORD "CommandLineSafe" with value 0
then another DWORD "LoadBehavior" with value 3
then a string value "Description"; we use "Rubberduck VBE add-in" for a value there
then another string value "FriendlyName", with value "Rubberduck"
then Office should see it
01:47
Ah, okay. That's making sense. And the .reg file doesn't add that automatically. Let me test that.
eh, that darn .reg file keeps reappearing... and we keep removing it from the repository...
@Mat'sMug If I call Console.ReadKey(), and the value isn't what I expected, is there a way to put the character back?
I've searched the web, and I can't find anything.
@Hosch250 what do you mean, put the character back??
Put the character back in the input stream.
you're asking for a key from the console, you're getting one...
I'm not following there
01:50
Yeah, but what if I want to get it again in a different place.
I'm missing quite a bit of context here
I also tried Console.In.Peek(), but that only appears to work when you press Return after each character.
OK, so I am reading the characters for my calculator one at a time.
i.e. you're making your life much harder than it needs to be
In C++, if the character was an integer or a '.', I could just read the double and it was smart enough to stop.
In C#, it appears I have to read the entire string and convert it.
Like, I could just do "123+123" in C++ and do std::cin >> d;, and it would read "123" and leave the rest in the input stream.
there's no input stream that I know of with a Console
it's just ...the Console
01:53
In C++ there is.
I know, that's iostream
So, is there an equivalent in C#?
in C# you'd Console.ReadLine and then parse the input
well that's what I'd do
Yeah, but that is a bloody pain, I was doing that before.
I guess you can turn the input string into a stream if you'd like
01:54
Instead of reading a character when you need it, you have to keep track of where you are in the string, pass the string around...
Hmm, maybe I need to look at a StreamReader.
287
A: how to generate a stream from a string?

Cameron MacFarlandpublic Stream GenerateStreamFromString(string s) { MemoryStream stream = new MemoryStream(); StreamWriter writer = new StreamWriter(stream); writer.Write(s); writer.Flush(); stream.Position = 0; return stream; } Don't forget to use Using: using (Stream s = GenerateStrea...

@ryankey721 works?
Now I have to have a global variable or pass the stream around, whereas C++ just had it available.
Hmm.
you only have a global variable if you make one... I don't understand. and C# isn't C++, if you want a stream you work with a Stream object
@Mat'sMug Sort of, Rubberduck showing up in Excel now which is good. However, I'm not sure which build it's using. I built the debug build again with some changes and they are not showing up in Excel after restarting.
you're 32-bit office right?
02:04
Yes, and 64-bit windows if it matters.
only the office version matters (luckily!). right-click the solution, get to the configuration manager and make sure you're using the Debug config (I've committed the solution using the Debug64 configuration)
if you've built under Debug64 you're running the last codebase that was successfully registered
K. It's set to Debug and the .dll's modification dates are updating after each build.
F5-debug should just work then
wait, project properties / debug - you need to set it to start EXCEL.EXE (or powerpoint if you like) on debug
Good call on explaining that, I was typing out the error information. Trying that now.
that will launch Excel after a successful build, and automatically attach the debugger to that process - which will let you put breakpoints and debug normally.
alternatively you can build the project, then start Excel and Debug/Attach to process... and manually attach the debugger.. but that's a PITA
tell me that worked ;)
02:20
That did work to launch Excel from Visual Studio and start the debug process. I'll have to play with the options for debugging in VS (most of my time has been spent on Linux). Still not seeing any of the changes that I made show up, so I will have to do some testing to find out why.
Thanks for your help
@Mat'sMug Thanks.
I ended up reading a string, putting it in a Stream and passing that to a StreamReader, and working from there.
@ryankey721 if you place a breakpoint (f9) with the process attached, is the red dot full, or hollow?
@Hosch250 great! that makes sense :)
I'm really looking forward to getting a review on this sometime :)
Maybe it will get me to the Intermediate level, instead of Advanced Beginner :)
Dishes time, see you.
later!
@Mat'sMug With the process attached I get a hollow red dot.
02:25
ugh something's wrong.
debugger's attached, but the debugging information doesn't match the code in VS
right-click the solution and then Clean, and then make a full rebuild
@RubberDuck ^^ you have competition ;)
K, did all of that. I tried "Break All (ctrl + alt +break)" with a Rubberduck window open and it broke execution and went to the next statement. Pressing F9 on that code gives me a full red circle.
cool. you're set!
Alright, I right clicked on the file that the break gave me and selected open containing folder. It led to a separate download of the source that I was working from. I moved that folder and now Excel gives "Rubberduck could not be loaded. Remove it from the list of available add-ins?"
For reference, I am currently working from a folder that VS is managing using git.
02:45
can you reinstate that folder and point git there? (not sure how to do this, Chris would)
Hmm, I guess that would work. Let me give it a try.
03:08
Huzzah! It worked after deleting the contents of that folder and resetting the git repo to point there. The only downside is that the root folder that I have to aim for is "Rubberduck-1.22", which means that my github repo has to be called that.
So if anyone thinks of a good way to reset where it is looking, it would be nice to not have a funny repo name. But thanks for your help, I'm going to redo my changes and test them tomorrow.
awesome!
03:33
@ryankey721 you might want to ask @RubberDuck about that - he's more knowledgeable than I am with git; I'm sure it's possible to do that.
 
1 hour later…
04:59
0
Q: How do I correctly pick up line numbers and line labels?

Mat's MugI'm using an ANTLR4 for C# grammar to generate a lexer+parser, so that I can tokenize VBA code (the grammar is a modified VB6 grammar I found here). The problem I'm having is that line numbers and line labels break the parser. Here are the relevant grammar rules: block : blockStmt (NEWLINE+ WS? ...

going to bed
05:16
nope.
fixed it!
Now post an answer so I can upvote that too.
nope, it only works with the sample code I supplied in the question.
editing the question
Please help:
@Hosch250 your question makes it sound as though everything works (roughly) and certain aspects just need refinement — royhowie 8 mins ago
Stubborn SO user.
05:47
ugh. so close
lineLabel : (INTEGERLITERAL WS) | (ambiguousIdentifier ':' NEWLINE);
this seems to work for the dummy example, but somehow fails with actual real code.
I give up. tired.
 
4 hours later…
09:39
> statement-label-definition = LINE-START ((identifier-statement-label ":") / (line-number-label [":"] ))
statement-label = identifier-statement-label / line-number-label
statement-label-list = statement-label ["," statement-label]
identifier-statement-label = IDENTIFIER
line-number-label = INTEGER
So, the only thing I really notice, is that the colon is optional for a line number, but not a line label.
09:57
Oops. Wait.
> statement-block = *(block-statement EOS)

block-statement = statement-label-definition / rem-statement / statement

statement = control-statement / data-manipulation-statement / error-handling-statement / filestatement
Compare that to this
 block : lineLabel? blockStmt (NEWLINE+ WS? blockStmt)* NEWLINE*;
A block doesn't end with a newline. It ends with an end of statement.
@RubberDuck Correct.
Are you just thinking out loud?
sigh
NEWLINE : WS? ('\r'? '\n' | ':' ' ') WS?;
Yeah @Rossco just rubberducking a bit.
I'm half ready to just faithfully translate the ABNF grammar into an EBNF grammar.
I need to get git integration done though.
I found the grammar is quite ambiguous.
verbatim.
Even ANTLR honey badger may not be enough to create a compiler for it.
That's the thing... It can't be ambiguous.
@RubberDuck Ahh, I would question the semantics of this.
10:12
If it was ambiguous, nothing would ever compile, right?
I would pull the colon space into a logical line separator
No ANTLR v4 can handle certain kinds of ambiguity
Yes. I'm trying to find it now.
you should watch the youtube video
its quite funny
WS : [ \t]+;
Shouldn't whitespace have some umm... Spaces in it?
I think there is a space in it.
10:15
What video @Rossco?
Oh. Right.
Without having looked through the entire grammar, I would wonder whether the EOS should have the colon+space in it
Thanks! Put it on my list to watch a bit later.
NEWLINE : WS? ('\r'? '\n') WS?;
I'm questioning, whether the WS before AND after should be included in the match.
10:19
That's a very good question.
I would think not.
It depends on whether it reduces the verbosity of other statements in the grammar, which is probably why it has been done.
But it's optional white space. Couldn't hurt.
whitespace is only meaningful when it is between keywords, identifiers etc.
True, I'd leave it there for now.
You also have this block-statement = statement-label-definition / rem-statement / statement
But it doesn't seem to account for statements with labels on the same line.
ie
BeginningOfLoop:  For i = 0 To 200
Which I believe is valid VBA
Why you would ever want to write that is a different story.
But it's valid. And here's the real problem that we have (I think).
The original grammar that we borrowed seems to have been written based on physical lines, when it should be based on logical lines.
So maybe block-statement = [statement-label-definition WS+] statement / rem-statementBut you would have to think about the LINE-START symbol
10:28
That's the spec grammar.
Yeah, I've read it too
And I really think that once I finish the feature I'm working on, I'm going to start from scratch and translate it into EBNF faithfully. See what happens.
Do you guys have any unit tests for the grammar?
That would be a good way to help develop the grammar
Then when you come across an edge case that isn't supported, just write a new test
e.g. when I just pointed out that labels can be on the same line
Then as you work on the grammar, you can see if you are breaking other things.
Also, there is a risk in trying to put too much semantic analysis into the grammar.
Example
Take the Option Explicitand Function ... declarations. They are both at the same level in a module.
But the former should not occur after the latter.
The question is, do you try and make the grammar enforce that? Or perform semantic analysis of that afterwards?
When I first played with the VBA grammar, I tried to put too much into the grammar and made life hard for myself.
The advantage you guys have is that the grammar is already checked by the VBA compiler, so you should be getting those checks for free.
You might not even need to perform the semantic checks I'm describing.
Idk. In my head, I picture getting to a place where we could potentially interpret VBA code. That would unlock some pretty cool possibilities.
And you're right about the tests. Maybe I'll start there.
I also like that if we could build our own grammar from scratch, we could get rid of that damn viral license.
viral?
ah GPL
10:40
The .g4 was licensed ... That^
I much prefer the MIT.
IMHO it's not about the code being free, but the dev.
Its a worth a go, even from a learning perspective. You could even do it TDD ;-)
After this feature. Yeah. After this feature I start from scratch.
So, I need to go start with my ANTLR "Hello World" calculator.
I built my VBA grammar in Irony and it had a Grammar Explorer where you could load your grammar and run it against some text you could paste into.
As far as I have found there isn't anything like that for Antlr.
which seems like an oversight.
Also I was going to ask this,
but the file handling stuff built into VBA sucks
really sucks
Are you considering adding an inspection for that?
and suggesting they use FileSystemObject?
I think that would make a good inspection.
I'm still not sure about this.
WS : [ \t]+;
Thinking about the grammar reminded me
10:46
Shouldn't the space be quoted?
I haven't written any ANTLR grammars myself so I guess its just a shorthand way of saying either a tab or space? Especially if it works.
You could include the Unicode characters that are in the official grammar if you wanted too.
I was thinking about that this morning too.
11:17
@RubberDuck line numbers have no colon. If there's one it's a redundant instruction separator ;)
Not according to the spec.
Ohhh. I see. Vague spec.
An EOS would have been inappropriate, so the optional colon in there to specify that an "optional" instruction separator is okay and has no effect.
11:57
@Rossco ANTLR has ANTLRWorks, a full-fledged IDE!
@RubberDuck I think the square brackets make the space literal
@Rossco the original .g4 would break if module options weren't specified first. I introduced a notion of a DeclarationsSection to fix that
And yes, we assume the code compiles when it's parsed
> 108 downloads
@Mat'sMug And I just installed it...
12:58
Hi all!
another fun night, for some values of fun, I see...
2
13:13
@FreeMan For some values of fun
13:34
We might have to undo line number support to ship a stable 1.3
...and that would suck
 
1 hour later…
15:07
I'm baaaaaack!
5
(throws a virtual "welcome back" party)
2
@Mat'sMug You mean a commit?
Yeah. Tonight.
And I'm very glad she didn't try to catch up with everything that happened... that might have killed her again!
15:11
she can't do that
@SimonAndréForsberg and welcome back to you too!
How was the trip?
or well... I could easily tell her to do that by instructing her to poll your repo for events, but that's not really useful as you're using it as a direct webhook instead :)
My grammar works! Wheeee
@RubberDuck Emotional. Full of impressions. Also full of nice people. First time I visit a country that has a weaponized-conflict in it.
Yeah.... I thought about that after you'd been gone a few days.
15:17
Being present at Maidan, where all the events last year happened, was extremely emotional. Looking into the eyes of the people in the pictures who lost their lives there last year...
Unreal man.
yikes
Unfortunately, it is real.
If you're interested, here's a two-minute video from when we visited Maidan and prayed for the victims:
@Nivaldo_N thanks! ...but why does that redirect me to some spammy magic weightloss website?
I can actually be seen at 1:26 :)
or can I? hmm... not sure if that is me or not...
16:16
Anyone have time for a quick Excel question?
maybe
How would I remove the (blank) aggregate in a pivot table like this?
ok
Do you have the blanks in your data source?
best way would be to remove them at the source. but I've seen pivot tables hiccup and make up (blank) items, too. so then you can filter them out.
Oh, shit. There is.
@sᴉɔuɐɹɥԀ Click the drop down arrow in the "Row Labels" cell and uncheck "(blank)"
or remove the bad data... :)
16:19
@FreeMan you'll have to select the field from the dropdown before though
Not sure I follow you...
Got it thanks guys :)
@FreeMan there's 2 fields involved; to filter the 2nd one you'll have to select it in a dropdown that pops up when you click that drop down arrow in the "row labels" cell. Oh nevermind, the (blank) data is in both levels.
@Mat'sMug winner, winner, chicken dinner!
:)
> ChrB, ChrW, String, LeftB, MidB, RightB are missing. What's the problem w/ MonthName and WeekdayName? What is Str?
16:30
OMG... how do I get this screeen?????
I think you need to run your grammar through the Java (JAVA?) testrig
Is One-To-One relationship in db not the same as One-To-One in math. Eg the id's in table A can be a super-set of the id's in table B?
17:12
@Duga 's back!
4
oh wow
6
A: Should I use Call keyword in VB/VBA?

JamieGAh ha. I have long wondered about this and even reading a two inch thick book on VBA basically says don't use it unless you want to use the Find feature of the VBE to easily find calls in large projects. But I just found another use. We know that it's possible to concatenate lines of code with ...

Function Test()
Function1 : Function2
End Function
^^ Function1 is interpreted as a line label
In some cases using the call keyword is pretty useful, like when you just want to use a class once. I use it today to generate a random salt Call New RNGCryptoServiceProvider().GetBytes(salt) without Call I would have had to a variable as an RNGCryptoServiceProvider first — yu_ominae Dec 12 '12 at 2:56
@Mat'sMug I'd have never run into this one - I didn't even know about the : until a week or so ago, and I would never do that to my self - makes the code to hard to read.
> @ckuhn203 the reason to use the strongly-typed <s>variants</s> *flavors*, is for performance reasons. Using the `Variant` ones incurs an additional implicit string conversion.

Perhaps we need to add a new `PerformanceTuneUp` inspection category?
+1 for a legitimage case... although I'd argue that having multiple instructions / function calls on a single line is a bad practice. — Mat's Mug 3 mins ago
@Duga I know the reason...
17:26
@Mat'sMug Amen!!!
@RubberDuck I know you know the reason ;)
I upvoted your comment :)
The Call New xxx.y() case is an issue. Our quickfix would break the code.
The multiple-function-call case is also problematic, MultipleDeclarationsInspection doesn't address it
Although user would probably disable that inspection...
17:42
:/ Just got this opening code in PowerPoint:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Runtime.InteropServices.COMException (0x8001010A): The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))
   at Microsoft.Vbe.Interop._VBProject.get_Name()
   at Rubberduck.UI.CodeExplorer.CodeExplorerDockablePresenter.<>c__DisplayClass2.<RefreshExplorerTreeView>b__0() in c:\Users\Christopher\Source\Repos\Rubberduck\RetailCoder.VBE\UI\CodeExplorer\CodeExplorerDo
RD 1.22 installed
Fixed on Master
my little PPT blow up? Y'all are awesome!
Well I think. I mean, IIRC there was a crash when I tested PPT the other day when I noticed unit testing in PPT was using an Excel.Application instance... when I was done I had working unit tests in PPT, and then I tweeted about it. Who the fuck writes VBA code in PPT?
I was about to say just that...
@FreeMan wait, you do? ;)
17:57
I could imagine PPT perhaps calling an Excel document or an Access DB to refresh some graphs or tables in a presentation... but anything else sounds a bit... overkill?
buckle up...
Access data base that generates Excel spreadsheets & PPTs
Don't ask, I know it's way more than necessary, but it's what it takes at the moment to appease non-technical overlords...
00:00 - 18:0018:00 - 00:00

« first day (320 days earlier)      last day (2860 days later) »