Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tddd55-lab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TDDD55 - Compilers and Interpreters
tddd55-lab
Commits
ace412b5
Commit
ace412b5
authored
1 year ago
by
johti17
Browse files
Options
Downloads
Patches
Plain Diff
Kill C++ Warnings, setting char* to const char*
parent
7fce49ea
No related branches found
No related tags found
1 merge request
!4
Updates cpp 2023
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lab2/lab2.hh
+2
-2
2 additions, 2 deletions
lab2/lab2.hh
lab2/lex.cc
+4
-4
4 additions, 4 deletions
lab2/lex.cc
lab2/lex.hh
+4
-4
4 additions, 4 deletions
lab2/lex.hh
with
10 additions
and
10 deletions
lab2/lab2.hh
+
2
−
2
View file @
ace412b5
...
@@ -24,10 +24,10 @@ public:
...
@@ -24,10 +24,10 @@ public:
class
Trace
class
Trace
{
{
static
int
indent
;
static
int
indent
;
char
*
name
;
const
char
*
name
;
public:
public:
Trace
(
char
*
s
)
Trace
(
const
char
*
s
)
{
{
name
=
s
;
name
=
s
;
cerr
.
width
(
indent
);
cerr
.
width
(
indent
);
...
...
This diff is collapsed.
Click to expand it.
lab2/lex.cc
+
4
−
4
View file @
ace412b5
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
// Human-readable representations of token types
// Human-readable representations of token types
//
//
static
char
*
kTokenTypeNames
[]
=
static
const
char
*
kTokenTypeNames
[]
=
{
{
"uninitialized"
,
"uninitialized"
,
"number"
,
"number"
,
...
@@ -238,7 +238,7 @@ Token Scanner::Scan(void)
...
@@ -238,7 +238,7 @@ Token Scanner::Scan(void)
// multiple-character token.
// multiple-character token.
//
//
void
Scanner
::
Accumulate
(
char
c
)
void
Scanner
::
Accumulate
(
const
char
c
)
{
{
if
(
position
>=
kMaxTokenLength
)
if
(
position
>=
kMaxTokenLength
)
{
{
...
@@ -312,12 +312,12 @@ ostream& operator<<(ostream& s, ScannerError& e)
...
@@ -312,12 +312,12 @@ ostream& operator<<(ostream& s, ScannerError& e)
// no argument version returns the type of the token.
// no argument version returns the type of the token.
//
//
char
*
Token
::
Lookup
(
void
)
const
char
*
Token
::
Lookup
(
void
)
{
{
return
kTokenTypeNames
[
type
];
return
kTokenTypeNames
[
type
];
}
}
char
*
Token
::
Lookup
(
TokenType
t
)
const
char
*
Token
::
Lookup
(
TokenType
t
)
{
{
return
kTokenTypeNames
[
t
];
return
kTokenTypeNames
[
t
];
}
}
This diff is collapsed.
Click to expand it.
lab2/lex.hh
+
4
−
4
View file @
ace412b5
...
@@ -30,11 +30,11 @@ class ScannerError
...
@@ -30,11 +30,11 @@ class ScannerError
{
{
public:
public:
char
errorCharacter
;
char
errorCharacter
;
char
*
message
;
const
char
*
message
;
int
state
;
int
state
;
ScannerError
(
char
c
,
int
s
)
:
errorCharacter
(
c
),
state
(
s
)
{};
ScannerError
(
char
c
,
int
s
)
:
errorCharacter
(
c
),
state
(
s
)
{};
ScannerError
(
char
*
s
)
:
message
(
s
)
{};
ScannerError
(
const
char
*
s
)
:
message
(
s
)
{};
ScannerError
()
:
errorCharacter
(
0
)
{};
ScannerError
()
:
errorCharacter
(
0
)
{};
};
};
...
@@ -86,8 +86,8 @@ public:
...
@@ -86,8 +86,8 @@ public:
double
numberValue
;
double
numberValue
;
char
*
symbolValue
;
char
*
symbolValue
;
char
*
Lookup
(
TokenType
);
const
char
*
Lookup
(
TokenType
);
char
*
Lookup
(
void
);
const
char
*
Lookup
(
void
);
Token
()
:
type
(
kUninitialized
)
{};
Token
()
:
type
(
kUninitialized
)
{};
Token
(
TokenType
t
)
:
type
(
t
)
{};
Token
(
TokenType
t
)
:
type
(
t
)
{};
Token
(
TokenType
t
,
double
x
)
:
type
(
t
),
numberValue
(
x
)
{};
Token
(
TokenType
t
,
double
x
)
:
type
(
t
),
numberValue
(
x
)
{};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment