DeanMc
Sep 22nd, 2009, 04:20 PM
Hi guys,
I will have a couple of these questions in the coming weeks as I am creating a new lexing DLL. Today I am looking at the structure of variable declarations in C#. So I have done all the written work and I seem to have come up with the following rules.
1: public int myVar = 2;
2: int MyVar = 2;
3: Public myClass.myVar varName = 2;
4: myClass.myVar VarName = 2;
So the overall rule seems to be:
(General Rules)
1: Each declaration will always have at least 2 words before the assignment.
2: Each declaration will have at most 3 words before the assignment.
3: The assignment operator is always a "="
4: The items after the = will be tested separately as they can be complex.
(Special Rules)
1: The first word will always be a whole word if there are 3 words before the =
2: The second word can contain whole words and periods only if as above.
3: The third word will follow variable conventions if as above.
So that's all I have at the moment. Since I have been staring at these I would appreciate a fresh pair of eyes. If you have anything to add or query let me know.
Thanks!
I will have a couple of these questions in the coming weeks as I am creating a new lexing DLL. Today I am looking at the structure of variable declarations in C#. So I have done all the written work and I seem to have come up with the following rules.
1: public int myVar = 2;
2: int MyVar = 2;
3: Public myClass.myVar varName = 2;
4: myClass.myVar VarName = 2;
So the overall rule seems to be:
(General Rules)
1: Each declaration will always have at least 2 words before the assignment.
2: Each declaration will have at most 3 words before the assignment.
3: The assignment operator is always a "="
4: The items after the = will be tested separately as they can be complex.
(Special Rules)
1: The first word will always be a whole word if there are 3 words before the =
2: The second word can contain whole words and periods only if as above.
3: The third word will follow variable conventions if as above.
So that's all I have at the moment. Since I have been staring at these I would appreciate a fresh pair of eyes. If you have anything to add or query let me know.
Thanks!