Comments (4)
You can write identifiers and paragraphs that start with digits.
Page 9 of Cobol V5.1 reference:
A COBOL word is a character-string that forms a user-defined word, a
system-name, or a reserved word. The maximum size of a COBOL user-defined
word is 30 bytes. The number of characters that can be specified depends on the
code page indicated by the compile-time locale.
Except for arithmetic operators and relation characters, each character of a COBOL
word is selected from the following set:
- Latin uppercase letters A through Z
- Latin lowercase letters a through z
- digits 0 through 9
- - (hyphen)
- _ (underscore)
The hyphen cannot appear as the first or last character in such words. The
underscore cannot appear as the first character in such words. Most user-defined
words (all except section-names, paragraph-names, priority-numbers, and
level-numbers) must contain at least one alphabetic character. Priority numbers and
level numbers need not be unique; a given specification of a priority-number or
level-number can be identical to any other priority-number or level-number.
In COBOL words (but not in the content of alphanumeric, DBCS, and national
literals), each lowercase single-byte alphabetic letter is considered to be equivalent
to its corresponding single-byte uppercase alphabetic letter.*
from typecobol.
As stated by Cobol reference:
The mantissa of a floating point always contains a decimal point (char '.' by default or char ',' if DECIMAL-POINT IS COMMA is specified).
So there's no confusion between a floating-point and a variable name.
Picture of a floating-point use almot the same syntax, except that char 'V' can replace the decimal point. The following picture clause are equivalent:
01 floatingPoint pic -9v9(9)E-99.
01 floatingPoint2 pic -9.9(9)E-99.
I can then write the following paragraph:
testFloatingPoint.
compute floatingPoint = 2.3E-13 + -3.444E-1.
from typecobol.
In the current version, the Scanner has been implemented with an important goal in mind : to help the developers correct their spelling mistakes by giving them meaningful error messages.
In several situations, the Scanner recognizes an "almost correct" input : it can then continue analyzing the program, and output a nice error message : "you must correct this detail, but I think I have understood what you where trying to say".
For example, if a user enters the string 23E-2, the Scanner will recognize it as an attempt to input a floating point literal, but will print an error message saying that a period is mandatory in the mantissa and that the exponent must be on two chars, helping the user to correct his mistake 23.0E-02.
If we don't do this, 23E-2 will be recognized a user defined word, a strange error will occur in the Parser while trying to match an arithmetic expression, and the developer may have a hard time understandind what happened.
So I chose to preserve this behavior, and then I can not support user defined words of the form 23E--02.
We have a tradeoff to make here : to make a good decision, we must try to evaluate which one of the two situations will be more frequent / important for our developers.
from typecobol.
Identifier beginning with digits but that don't look like numeric literals are now properly recognized.
As the primary problem is solved, I'll close this issue.
Please continue discussing this topic in issue #65.
from typecobol.
Related Issues (20)
- NullReferenceException when getting DataDefinition.StartPosition property
- Incorrect URI management in notifications PublishDiagnostics and MissingCopies
- Check URI management in Language Server
- Value cannot be null. (Parameter 'source')
- InvalidOperationException in lazy field RedefinedVariable of DataRedefines
- Missing diagnostic on invalid picture/usage combination
- PictureType length may be wrong when picture category is NationalEdited
- Missing compatibility check between Picture and Usage
- NullReference in RedefinesChecker.OnNode(DataRedefines redefinesNode) HOT 1
- Optimize the StartPosition property
- CFG in Extended mode maybe wrong
- VALUE clause cannot be specified in conjunction with REDEFINES and for an item having a parent with a VALUE clause
- Upgrade to .NET 8
- Ensure build order
- Do not use Assembly.LoadFrom ?
- Incorrect encoding for alphanumeric literals using hexadecimal notation HOT 3
- Support for LSP refactoring requests HOT 2
- Invalid cast in TableDefinitionExtensions.GetTableSortingKeys HOT 1
- Implement new command AdjustFillers
- Invalide precedence of operators when building abbreviated relation conditions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typecobol.